Re: Text and Tspan and Anchors - OH MY

Thomas:

There are already bug reports for this on the major browsers

Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=890692
Chrome: https://code.google.com/p/chromium/issues/detail?id=375258

Both of these browsers currently do not propagate the textLength
adjustments to child <tspan> elements.  The <tspan> content gets rendered
at its normal width, and then the rest of the content of the <text> element
gets adjusted to meet the final textLength.  Since the only remaining
content available to adjust is the whitespace before and after the
<tspan>s, that's what gets stretched out.

The total text *does* fill the space, but most of it is filled by
stretched-out space characters.

IE stretches things out slightly differently, still exaggerating the
whitespace but also stretching the second tspan.  I haven't tested this
fiddle, but based on webkit bug reports (
https://bugs.webkit.org/show_bug.cgi?id=139210), they also have
difficulties with text length adjustments.

*In other words, we probably need clearer definitions of the expected
behavior, and significant overhauls of implementations.*  Part of the
problem is that the original purpose of textLength was only as a rendering
hint, to control differences between fonts, but everyone wants to use it as
a stretch/compress tool.

Also, as a side note, you probably don't want the `xml:space="preserve"`
setting.  Although it does not behave like an <pre> element in HTML, it
does make sure (in a SVG 1.1 viewer) that each space, tab, or newline
character in your code gets reflected as a space in the final text
content.  SVG 2 deprecates this in favour of using CSS for whitespace
control.

AmeliaBR



>  *From:* Smailus, Thomas O
> *Sent:* Thursday, March 12, 2015 16:35
> *To:* www-svg
> *Subject:* Text and Tspan and Anchors - OH MY
>
>
>
> I’m curious about what this SVG 1.2se should be rendered as:
>
>
>
> The text specifies a location and length, the tspan elements should FILL
> that extent, yes?
>
> But no, that’s not the case (http://jsfiddle.net/thomassmailus/rxzatmnz/ )
>
>
>

Received on Friday, 13 March 2015 01:30:00 UTC