See https://bug1753399.bmoattachments.org/attachment.cgi?id=9262064 and the associated bug report (link below). 1ch in that font matches 1em, however it should match 0.5em per spec. It was reported to Firefox as a lack of interop when dealing with ch units on fonts without a "0" glyph, but the spec is pretty clear, see https://bugzilla.mozilla.org/show_bug.cgi?id=1753399#c2 See also https://bugs.chromium.org/p/chromium/issues/detail?id=1293773
<rdar://problem/88513297>
We don't set it to 1em; we set it to the width of .notdef in that case.
Created attachment 450959 [details] WIP
Comment on attachment 450959 [details] WIP View in context: https://bugs.webkit.org/attachment.cgi?id=450959&action=review > Source/WebCore/platform/graphics/Font.cpp:154 > - m_fontMetrics.setZeroWidth(widthForGlyph(zeroGlyph)); > + m_fontMetrics.setZeroWidth(zeroGlyph ? widthForGlyph(zeroGlyph) : platformData().size() / 2); I guess this isn't a great fix because it isn't ch-specific.
Created attachment 450968 [details] Patch
Comment on attachment 450968 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=450968&action=review > LayoutTests/ChangeLog:9 > + This can't be a WPT test because it uses an SVG font which we're the only browser to support. Is there any reason you can't make this test use a non-SVG font? Also I have a vague memory of writing such a WPT at one point but I might be mistaken.
https://phabricator.services.mozilla.com/D61190 is relevant
I think Jonathan Kew is right - WebKit's behavior isn't great here, because we won't search fallback fonts to find the font used to render the '0' character. This patch at least gets us closer to the spec, but we're probably far enough away that this test probably shouldn't be a WPT test. When I align our behavior with Firefox's, this test will end up being deleted and replaced with another one.
Committed r289151 (246847@main): <https://commits.webkit.org/246847@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 450968 [details].
Thanks for fixing so fast! Fwiw there are tests for this in wpt (css/css-values/ch-unit-013-018.html). It seems those are not in the tree though.