[COLRv1] Font with PaintColrGlyph cycle gets eagerly rejected
Categories
(Core :: Layout: Text and Fonts, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox127 | --- | fixed |
People
(Reporter: drott, Assigned: jfkthame)
Details
Attachments
(5 files)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36
Steps to reproduce:
Display glyphs from a COLRv1 test font that, in another glyph, has a PaintColrGlyph cycle. Open index.html from the attached zip file.
(Found while testing coincident color stops and angles, further investigating issues like in issue 1817826).
Actual results:
No glyphs are shown, console complains about parsing errors with the font, sanitizer rejects font.
downloadable font: COLR: Cycle detected in PaintColrGlyph (font-family: "ctest" style:normal weight:400 stretch:100 src index:0) source: file:///Users/drott/dev/ff_colr/test_glyphs-glyf_colr_1.ttf
downloadable font: COLR: Failed to parse referenced color glyph 176 (font-family: "ctest" style:normal weight:400 stretch:100 src index:0) source: file:///Users/drott/dev/ff_colr/test_glyphs-glyf_colr_1.ttf
downloadable font: COLR: Failed to parse referenced color glyph 177 (font-family: "ctest" style:normal weight:400 stretch:100 src index:0) source: file:///Users/drott/dev/ff_colr/test_glyphs-glyf_colr_1.ttf
downloadable font: COLR: Failed to parse paint for base glyph ID 176 (font-family: "ctest" style:normal weight:400 stretch:100 src index:0) source: file:///Users/drott/dev/ff_colr/test_glyphs-glyf_colr_1.ttf
downloadable font: COLR: Failed to parse base glyph list (font-family: "ctest" style:normal weight:400 stretch:100 src index:0) source: file:///Users/drott/dev/ff_colr/test_glyphs-glyf_colr_1.ttf
downloadable font: COLR: Failed to parse table (font-family: "ctest" style:normal weight:400 stretch:100 src index:0) source: file:///Users/drott/dev/ff_colr/test_glyphs-glyf_colr_1.ttf
downloadable font: rejected by sanitizer (font-family: "ctest" style:normal weight:400 stretch:100 src index:0) source: file:///Users/drott/dev/ff_colr/test_glyphs-glyf_colr_1.ttf
Expected results:
The font should be accepted, the two glyphs of the test page should be drawn. Paint cycles should be rejected on a per glyph basis.
A PaintColrGlyph cycle is a problem that is specific to a particular set of glyphs involved in creating the cycle.
The COLRv1 spec talks about how the remainder of the graph should be drawn if possible:
https://learn.microsoft.com/en-us/typography/opentype/spec/colr#color-glyphs-as-a-directed-acyclic-graph:~:text=If%20the%20graph,formed%20and%20valid.
This part of the spec can perhaps be read as a tendency of the spec being in favor of trying to not only render the remainder of the same glyph, but also, not rejecting the whole font based on a PaintCycle in a set of glyphs.
Background: The test font we're using for testing Chrome's implementation recently received two test glyphs for testing paint cycles. https://github.com/googlefonts/color-fonts/pull/122
If FireFox rejects this font as a whole, the test font can no longer be used as a whole, but a separate version would need to be made to test paint cycles.
I'd be in favor of seeing a change in FF that rejects PaintCycles only on a per glyph basis.
Comment 1•2 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Layout: Text and Fonts' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
| Assignee | ||
Comment 2•2 years ago
•
|
||
This is being rejected by the OTS COLR table validation here and here, isn't it? So if we want to change the behavior, that's the place to do it.
Indeed, I see we (briefly) discussed this back in https://github.com/khaledhosny/ots/commit/4e1d51e039ed92246da7e7d6ee775bab23c3d099.
Updated•2 years ago
|
| Assignee | ||
Comment 3•2 years ago
|
||
We landed a patch for this in https://github.com/khaledhosny/ots/pull/272, so all we need to do here is to vendor the latest upstream code.
| Assignee | ||
Comment 4•2 years ago
|
||
Generated by running
./mach vendor --patch-mode none gfx/ots/moz.yaml
and committing the resulting changes.
Updated•2 years ago
|
| Assignee | ||
Comment 5•2 years ago
|
||
This was merged upstream in https://github.com/khaledhosny/ots/pull/266.
| Assignee | ||
Comment 6•2 years ago
|
||
Generated by running
./mach vendor --patch-mode only gfx/ots/moz.yaml
| Assignee | ||
Comment 7•2 years ago
|
||
Comment 9•2 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/84df086ee5f6
https://hg.mozilla.org/mozilla-central/rev/2025ae0d3820
https://hg.mozilla.org/mozilla-central/rev/1734d4af3e8f
https://hg.mozilla.org/mozilla-central/rev/bf25285b1d73
Description
•