Re: Switch and Feature Strings

On Tuesday, September 27, 2005, 8:12:31 AM, Doug wrote:

DS> Hi, Chris-

DS> Thanks for your reply.

| DS>> I tried setting up a 'switch' with 'textPath', since FF1.5b1 does 
| DS>> have some text support, but not 'textPath' (or 'tspan', among 
| DS>> others). But it seems that switch does not support this 
DS> | degree of granularity.
DS> | 
DS> | Could you give a snippet of svg to illustrate?
DS> | 
DS> | You mean like
DS> | 
DS> | <switch>
DS> |   <textPath sometestattr ....>blah on a path</textPath>
DS> |   <text>blah</text>
DS> | <switch>

DS> Well, this sample doesn't work, but I don't know if I'm simply doing
DS> something wrong:

It looks correct to me. You can test if requiredFeatures is itself
implemented:

<switch>
   <text requiredFeatures='http://www.w3.org/TR/SVG11/feature#textPath' x="100" y="100">Yes!</text>
   <text  x="100" y="100">No :(</text>
</switch>

DS> <switch>
DS>    <g requiredFeatures='http://www.w3.org/TR/SVG11/feature#textPath'>
DS>       <defs>
DS>          <path id='textPath' d='M50,200 C100,50 450,50 550,200' />
DS>       </defs>
DS>       <text text-anchor='middle' font-size='85px'><textPath
DS> xlink:href='#textPath' startOffset='50%'>Sample Text</textPath></text>
DS>    </g>
DS>    <g>
DS>       <text x='300' y='90' text-anchor='middle' font-size='85px'>Sample
DS> Text</text>
DS>    </g>
DS> </switch>

DS> What I would have expected and liked would be for the ability to use a
DS> requiredFeature string at the 'textPath' element level, not just the 'text'
DS> module level.

You can. It functions as a binary switch - if its true, the element
renders. if not, it doesn't.

However, switch gives you a case statement rather than an if...then

DS>  In partial implementations, I expect that that would be very
DS> useful.


| DS>>  Am I misreading the
| DS>> Spec, or misusing switch? If it isn't addressed in the 
DS> | Spec, perhaps 
| DS>> it should be; not all UAs will have every feature from a module, 
| DS>> realistically, and I'd like to use 'switch' to provide fallbacks.
DS> | 
DS> | That is the intent, yes - to test and provide fallbacks.

DS> Yes, I just don't know if perhaps I was using it incorrectly. Is there some
DS> way to test for a specific element being implemented?

You mean a specific test attribute, or a specific element?

DS> Regards-
DS> Doug

DS> doug . schepers  @ vectoreal.com
DS> www.vectoreal.com ...for scalable solutions.





-- 
 Chris Lilley                    mailto:chris@w3.org
 Chair, W3C SVG Working Group
 W3C Graphics Activity Lead
 Co-Chair, W3C Hypertext CG

Received on Tuesday, 27 September 2005 16:41:40 UTC