-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow transforms on textPath #210
Comments
This has come up before, with no outcome to the discussion: I think it should be fine to add transform to these elements. With the transform applying to the region returned by getBBox() as described by Amelia. |
Yes, if transforms are valid for In contrast, My preference is to just allow transformations on all of them, with the transformation applied after all other text layout. That's actually how it's currently specced, although it's a bit of an unintentional intersection of two different specs: CSS Transforms says that any SVG element that accepts a If there is an implementation difficulty with transformations on wrapping SVG text spans, we can consider exceptions. But as is, @karip, feel free to file user agent bug reports on anyone that doesn't support transforms on |
Having gone through the algorithm section, I am against allowing transforms on |
No, that has no effect. The path data is used, not the actual path element. It is always interpretted in the coordinate system of the |
Firefox and Chrome apply transforms to the path element: http://codepen.io/Tavmjong/pen/rLdGdK |
Seems like implementers are against adding transforms to inline elements. It might be difficult to get two implementations for this, so perhaps this shouldn't be added, or at least marked as “at-risk”. |
IIRC, the original argument for adding transform to How do you handle |
Interesting. We should spec that more clearly one way or the other. However, it's still not the same as the textPath itself getting transformed, as is obvious when you apply a scaling transform. |
That is just weird! But it seems to be an artifact of CodePen. Look at: http://tavmjong.free.fr/SVG/text_on_path_transform.svg This doesn't exhibit the strange behavior. |
The "strange behavior" is what you want if you apply a scale transform to a But I do agree that it might sometimes be nice to fit text to a transformed path without transforming the text itself, which is why we should spec the Chrome/Firefox behavior. Note that Edge currently behaves differently: the text glyphs don't get stretched, but they are stretched out along the path, proportional to the scaling factor. |
FWIW, what Chrome/Blink (and FF; and Presto) implements is an interpretation of: https://www.w3.org/TR/SVG/text.html#TextPathElementHrefAttribute (still roughly the same at https://svgwg.org/svg2-draft/text.html#TextPathElementHrefAttribute) Well, I guess Edge does too, but they seem to compute the positions on the path before applying the path transform (or something.) |
Thanks @fsoder. I'd remembered the first half of that paragraph (coordinates interpretted in the text element's coordinate system), but not the second (transform specified directly on the path still applies). But yes, still need to clarify the details of what it means to transform the path that a textPath uses, versus transforming the textPath (and/or parent text element) itself. |
We resolved on this morning's call that text and tspan are treated as inline elements and inline elements can't have transform. https://www.w3.org/2016/07/21-svg-minutes.html#item03 Actions:
|
Just to clarify. Browsers do support transforms on |
Spec updated in commit 98808bf |
Did we mean to say that The note in 10.2. The ‘text’ and ‘tspan’ elements says the former. |
Filed issue on CSS Transforms for definition of transformable elements - w3c/csswg-drafts#358 |
|
Yeah the other sections are good, it's just the note that wasn't as specific. |
Including some final edits with respect to issues #200 and #210, as well as general typo fixes, formatting, and clarification. Changes the definition and example of `shape-margin` to reflect the fact that this is a property of the excluded element, not the element from which the exclusion is subtracted. (attn @Tavmjong) Adds a note about ::before and ::after being possible in the future (see #125). Makes ::selection and :focus styles a requirement for interactive user agents, while leaving open how that is implemented. (Most web browsers use background color as part of a selection style, and we don't have a way of specifying background color on a span of text!) Not the full edit I'd like to have done, but hopefully caught most normative issues.
This recently came up in Chromium (see: https://crbug.com/1175868) and we noticed the SVG2 spec still lists |
I find it upsetting that the spec was changed to do the opposite of what this issue was requesting. I'm in a tough situation right now where I need custom slanted text on a circular path, and I can't do that without being able to transform Do I have any options here? |
The 'tspan' and 'a' element already have the transform property. It would be nice if
textPath
would also have it, to make all text element children behave similarly. The use cases are the same as fortspan
: jiggling animations etc.Currently, one has to resort to a wrapper
a
element:<text>Hello <a transform="rotate(45)"><textPath path="..">rotated text on path</textPath></a> !!</text>
The text was updated successfully, but these errors were encountered: