Re: does the systemLanguage attribute apply to tspan? alternatively does the switch element take x & y coordinates?

Hi, Jonathan-

 > does the systemLanguage attribute apply to tspan?

A more pertinent question is whether the 'switch' element can be a child 
of the 'text' element.  Unfortunately, the answer is no; according to 
the DTD, these are the possible parents of 'switch'

'svg', 'g', 'defs', 'symbol', 'switch', 'marker', 'pattern', 'mask', 
'a', 'glyph', and 'missing-glyph'.

> this code sample*** fails to work with current implementations.
> ***
> <text x="130" y="65">
>   <switch >
>      <tspan systemLanguage="it" >giochi</tspan>
>      <tspan systemLanguage="fr" >jeux</tspan>
>      <tspan systemLanguage="es" >juegos</tspan>
>      <tspan systemLanguage="de" >spiele</tspan>
>      <tspan >games</tspan>
>   </switch>
> </text>
 > It seems desirable that tspan should be supported but the
 > specification isn't explicit, and current implementations
 > don't.

Yes, that is not a correct use of 'switch', so implementations are 
correct not to support it, but I agree that would be very useful.

The prose of the spec could certainly be clearer, but it is explicit in 
the DTD.  I agree that it would be better if such things  were made more 
clear for authors.

> alternatively does the switch element take x & y coordinates?  ie 
> <switch x="130" y="65">

No, but it does allow the 'transform' attribute.  The following doesn't 
seem to be supported in FF1.5, though it does work in Opera9 and ASV3:

    <switch transform='translate(130,250)'>
       <text systemLanguage="it">giochi</text>
       <text systemLanguage="fr">jeux</text>
       <text systemLanguage="es">juegos</text>
       <text systemLanguage="de">spiele</text>

> According to current SVG1.1 implementations each example of text must be 
> placed independently as in this simple example**.
> this requires much duplication.

Agreed.  If you are using a large number of attributes (fill, stroke, 
text-decoration, letter-spacing, font-size, font-family, etc.), this 
would be even more tedious, especially in Tiny where you can't use CSS.

> my apologies once again, if I have failed to understand the intended 
> method of laying out text when using systemLanguage and switch.

You got it right.  I don't know why this isn't allowed.  There may be a 
good reason that doesn't occur to me.  I'll bring it up with the rest of 
the SVG WG, and get back to you.

 > **
 > <switch>
 >   <text systemLanguage="it" x="130" y="65">giochi</text>
 >   <text systemLanguage="fr" x="130" y="65">jeux</text>
 >   <text systemLanguage="es" x="130" y="65">juegos</text>
 >   <text systemLanguage="de" x="130" y="65">spiele</text>
 >   <text x="130" y="65">games</text>
 > </switch>

Try this instead:

    <g transform='translate(130,65)'>
          <text systemLanguage="it">giochi</text>
          <text systemLanguage="fr">jeux</text>
          <text systemLanguage="es">juegos</text>
          <text systemLanguage="de">spiele</text>

It's a little clunky, but it gets the job done for most uses.



Research and Standards Engineer
6th Sense Analytics
mobile: 919.824.5482

Received on Wednesday, 14 March 2007 01:17:40 UTC