W3C home > Mailing lists > Public > www-svg@w3.org > March 2007

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

From: Doug Schepers <doug.schepers@vectoreal.com>
Date: Wed, 14 Mar 2007 12:17:24 +1100
Message-ID: <45F74D24.4070001@vectoreal.com>
To: ~:'' ありがとうございました。 <j.chetwynd@btinternet.com>
Cc: SVG List <www-svg@w3.org>, SVG WG <w3c-svg-wg@w3.org>

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>
       <text>games</text>
    </switch>



> 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)'>
       <switch>
          <text systemLanguage="it">giochi</text>
          <text systemLanguage="fr">jeux</text>
          <text systemLanguage="es">juegos</text>
          <text systemLanguage="de">spiele</text>
          <text>games</text>
       </switch>
    </g>

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

-- 

Regards-
-Doug

Research and Standards Engineer
6th Sense Analytics
www.6thsenseanalytics.com
mobile: 919.824.5482
Received on Wednesday, 14 March 2007 01:17:40 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:36 GMT