Support the 'letter-spacing' and 'word-spacing' properties in SVG
Categories
(Core :: SVG, defect)
Tracking
()
People
(Reporter: a.neumann, Assigned: heycam)
References
(Blocks 2 open bugs, )
Details
(4 keywords)
Attachments
(1 file, 1 obsolete file)
Updated•18 years ago
|
Updated•15 years ago
|
![]() |
||
Updated•15 years ago
|
Updated•14 years ago
|
Comment 4•12 years ago
|
||
Comment 5•12 years ago
|
||
Updated•12 years ago
|
Updated•11 years ago
|
Updated•11 years ago
|
![]() |
||
Comment 6•11 years ago
|
||
Assignee | ||
Comment 7•11 years ago
|
||
Comment 8•11 years ago
|
||
Comment 9•10 years ago
|
||
Comment 10•10 years ago
|
||
![]() |
||
Comment 11•10 years ago
|
||
Comment hidden (me-too) |
Comment 13•10 years ago
|
||
Comment 14•10 years ago
|
||
Comment 15•10 years ago
|
||
Comment 16•10 years ago
|
||
![]() |
||
Comment 17•9 years ago
|
||
Comment hidden (advocacy) |
Comment hidden (me-too) |
Updated•9 years ago
|
Comment hidden (me-too) |
Comment hidden (off-topic) |
Comment hidden (off-topic) |
Comment hidden (off-topic) |
Comment 25•8 years ago
|
||
Comment 26•8 years ago
|
||
Updated•8 years ago
|
![]() |
||
Comment 27•7 years ago
|
||
Comment 28•6 years ago
|
||
Comment 29•6 years ago
|
||
Comment 30•6 years ago
|
||
Well, just gave that a shot and that's not enough itself. I missed one of the other early returns, but clearly that's not enough. Letter spacing is probably easy since you can just use the same mechanism as dx
, and not handle it in nsTextRun. word-spacing however is (probably?) harder.
Comment 31•6 years ago
|
||
I think the DOM APIs may come out in the wash if you do it right.
Comment hidden (me-too) |
Assignee | ||
Comment 33•5 years ago
|
||
The right way to handle this is to ensure we have an appropriate PropertyProvider
object whenever we call into glyph measuring functions on text runs. I wrote a patch and it didn't seem too tricky in the end.
Assignee | ||
Comment 34•5 years ago
|
||
Some trickiness would be needed to ensure getEndPositionOfChar
and getExtentOfChar
don't include any letter-spacing or word-spacing that comes after it. I haven't handled that. We'd need to add some new function or flags to measure advances on a text run that specifically exclude any final space. I'm inclined to leave that to a followup.
Assignee | ||
Comment 35•5 years ago
|
||
Assignee | ||
Comment 36•5 years ago
|
||
(In reply to Cameron McCormack (:heycam) from comment #33)
The right way to handle this is to ensure we have an appropriate
PropertyProvider
object whenever we call into glyph measuring functions on text runs.
Robert's approach to explicit get the spacing information and apply it during SVG glyph positioning could also work, but I think it would be harder to ensure that we apply spacing in exactly the same way that CSS does. So I think it's easier to rely on nsTextFrame
to position its glyphs with letter-spacing etc. applied, and then use those results when layering on the SVG glyph positioning.
Assignee | ||
Comment 37•5 years ago
|
||
Comment hidden (obsolete) |
Assignee | ||
Comment 39•5 years ago
|
||
Comment 40•5 years ago
|
||
Comment 41•5 years ago
|
||
bugherder |
Comment 42•5 years ago
|
||
Since I raised w3c/csswg-drafts#4498, let me also ask the question here: how can author detect the existence of this feature?
Assignee | ||
Comment 43•5 years ago
|
||
There's no pure CSS way to detect whether letter-spacing and word-spacing have an effect on SVG text (since @supports
would return true for the properties in general). It was kind of just a bug that we didn't support these properties on SVG text.
If you have script available you can always create a <text>
element with spacing, then look at the bounding box or something to tell if it has an effect.
Assignee | ||
Comment 44•5 years ago
|
||
Release Note Request (optional, but appreciated)
[Why is this notable]: Support for making letter-spacing and word-spacing work on SVG text is a common author request.
[Affects Firefox for Android]: Yes, this is a platform feature.
[Suggested wording]: The letter-spacing and word-spacing CSS properties now work on SVG text.
[Links (documentation, blog post, etc)]: Maybe just https://developer.mozilla.org/en-US/docs/Web/CSS/letter-spacing and https://developer.mozilla.org/en-US/docs/Web/CSS/word-spacing.
![]() |
||
Comment 45•5 years ago
|
||
There are more specific articles for SVG:
https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/letter-spacing
https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/word-spacing
Comment 46•5 years ago
•
|
||
Is this worth a mention in the main (user-facing) release notes or is a developer note at https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/72 sufficient?
Updated•5 years ago
|
Comment 48•5 years ago
|
||
This bug still appears to be present in Firefox 72, even though stated that it is fixed.
Comment 49•5 years ago
|
||
Yes, it was disabled in bug 1599173 because of a serious regression, and then re-enabled when fixed, which was bug 1600855 (and which unfortunately didn't make it on time for 72). So will be in 73.
Comment 50•5 years ago
|
||
(In reply to Emilio Cobos Álvarez (:emilio) from comment #49)
Yes, it was disabled in bug 1599173 because of a serious regression, and then re-enabled when fixed, which was bug 1600855 (and which unfortunately didn't make it on time for 72). So will be in 73.
Ok, thanks!
Comment 51•5 years ago
|
||
thank you!
Updated•5 years ago
|
Comment hidden (off-topic) |
Comment hidden (obsolete) |
Description
•