[svgwg] Issue: text chunk, current text position, and text-anchor marked as Text chapter

svgeesus has just labeled an issue for https://github.com/w3c/svgwg as "Text chapter":

== text chunk, current text position, and text-anchor ==
https://svgwg.org/svg2-draft/text.html#TextElement

The specification is not clear about how text chunks, current text position, and text-anchor interact.

The spec states
> The ‘text’ element renders its first glyph (after bidirectionality reordering) at the initial current text position (with possible adjustments due to the value of the text-anchor property or the text-align property).

The definitions for "alignment point" and "current text position" imply that characters are painted at the current text position.

The description about current text position does not include the case for text-anchor:
>The ‘text’ element renders its first glyph (after bidirectionality reordering) at the initial current text position (with possible adjustments due to the value of the text-anchor property or the text-align property). For pre-formatted text and for auto-wrapped text where the content area is determined by the inline-size property, the initial current text position is determined by the ‘x’ and ‘y’ values of the ‘text’ or ‘tspan’ element which contains the first rendered character. For auto-wrapped text in a shape or text on a path see the Auto-wrapped text or Text on a path sections, respectively, to determine the initial current text position. After the glyph(s) corresponding to the given character is (are) rendered, the current text position is updated for the next character. In the simplest case, the new current text position is the previous current text position plus the glyphs' advance value (horizontal or vertical). See text layout for a description of glyph placement and glyph advance.

Consider a text chunk "bcc" rendered with an initial current text position of (0,0) but with text-anchor="end". Say the text chunk is 50 pixels long. When the "bcc" text chunk is finished rendering, is the current text position (0, 0) (where the string actually ended) or is the current text position (50, 0)?

The intent seems to be the former, but Chrome and Firefox implement the latter.
- https://jsfiddle.net/pd6Ly53s/

To be concrete, here are text chunks "bcc" and "de". (Text chunks are started when there is an absolute x or y assignment.)
>  <text x="0" y="0" text-anchor="end">bcc<tspan y="10">de</tspan>&lt/text>

The "bcc" is painted to text-anchor:end at (0,0), but where does "de" end up? I think the intent is it is text-anchor:end at (0,0), but Chrome and Firefox make it text-anchor:end at (50,0) (where "bcc" would have ended if it were painted with text-anchor="start").



See https://github.com/w3c/svgwg/issues/518

Received on Saturday, 22 September 2018 22:01:50 UTC