Re: SVG12: Text Layout vs Scripting

Bjoern Hoehrmann wrote:
> * Thomas DeWeese wrote:
> 
>>>Thus, please change the SVG 1.2 Working Draft such that it is clear that
>>>calling forceRedraw() has the desired effect (text layout for all text
>>>content elements in the document tree is completed and consequently the
>>>text layout depended method calls such as getComputedTextLength() and
>>>getBBox() work as expected) 
>>
>>    Please _don't_ do this!
> 
> You seem to imply that forceRedraw() currently does not necessarily
> cause this and that it should not cause this. Maybe you can clarify
> why you think so or what you mean instead?

    I don't think any SVG DOM calls should depend on calling
forceRedraw().  This would be a horrible hack.  As to weather
forceRedraw currently does or doesn't cause this behavior I have no
idea for ASV, I know it does nothing for Batik.  If the implementation
can render the document (i.e. forceRedraw will work) then the
implementation can and should have these methods work, without
requiring people to call some 'magic' method.

>>   I'd be curious how you came to this conclusion, because I just
>>checked Batik and ASV and both of them behave this way (getBBox works
>>on text that has been dynamically created and inserted into the
>>document, before any rendering has happened).  In my mind this is the
>>only reasonable solution.
> 
> With Adobe SVG Viewer 6.0 Build 38363 the following [...]
> 
> does not work reliably, especially when re-loading the document, most
> of the time a computed text length of 0 will be reported. Sometimes an
> accurate length is reported though, so maybe you've hit some kind of
> race condition. Adobe SVG Viewer 3.0x is subject to the same problem as
> far as I can tell.

    So I only get this problem with the _Beta_ ASV 6.0 on IE (your
test works fine with ASV 6.0 and Mozilla, and on all my browsers for
ASV 3.02).  I would be curious to hear what Adobe has to say but I
would personally write this off as a bootstrapping bug in 6.0.

>   <svg
>     xmlns               = "http://www.w3.org/2000/svg"
>     version             = "1.2"
>   >
>   <text y = '100' font-size='50'>
>     <tspan onload="alert(evt.target.getComputedTextLength())"
>     >Scalable Vector Graphics</tspan>
>   </text>
>   </svg>

Received on Wednesday, 12 January 2005 13:21:25 UTC