[svgwg] Issue: Interaction of `x` attribute and `startOffset` in a textPath element. marked as SVG Core

nikosandronikos has just labeled an issue for 
https://github.com/w3c/svgwg as "SVG Core":

== Interaction of `x` attribute and `startOffset` in a textPath 
element. ==
Relevant spec section: 
https://svgwg.org/svg2-draft/single-page.html#text-TextpathLayoutRules

See also the following bug I reported to FF: 
https://bugzilla.mozilla.org/show_bug.cgi?id=1195249
And an email to the mailing list last year: 
https://lists.w3.org/Archives/Public/www-svg/2015Aug/0007.html

Consider the following file:

```
<svg xmlns="http://www.w3.org/2000/svg"
        xmlns:xlink="http://www.w3.org/1999/xlink"
        viewBox="0 0 80 80">
    <defs>
        <path id="myTextPath"
              d="M16,40 a24,24 0 0,1 48,0" />
    </defs>

    <path d="M16,40 a24,24 0 0,1 48,0" style="stroke:#600; 
fill:none"/>
    
    <text x="5">
        <textPath xlink:href="#myTextPath" 
startOffset="50%">|</textPath>
    </text>
</svg>
```

http://jsfiddle.net/u5z02hpx/9/

How should the conflict between the `x` attribute and the 
`startOffset` attribute be resolved?

According to both the 1,.1 and 2 specs:

> When the inline-base direction is horizontal, then any ‘x’ 
attributes on ‘text’ or ‘tspan’ elements represent new absolute 
offsets along the path, thus providing explicit new values for 
startpoint-on-the-path.


*SVG 1.1 also included tref and altGlyph in the list of elements 
included in this paragraph.*

"startpoint-on-the-path" is calculated from `startOffset` and 
`text-anchor`.  So this statement appears to indicate that `x` should 
override `startOffset`.  Or at the very least effect it in some way.

Browser interpretation varies:

Firefox: Uses `startOffset`. `x` is ignored
Chrome: seems to be calculating `x + startOffset`
IE: Uses `x`. `startOffset` is ignored.

We should clarify the correct interpretation.  I am wondering if the 
inclusion of the `<text>` element in the above copy was originally a 
mistake.  Since `<text>` are not valid inside a `<textPath>`, perhaps 
it was the intention that only the `x` attribute of elements 
**inside** a textPath were affected by this rule.  In other words, 
that would now only be `<tspan>`. 



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

Received on Monday, 12 September 2016 05:04:46 UTC