Expose glyph emHeights in TextMetrics
Categories
(Core :: Graphics: Canvas2D, task)
Tracking
()
Tracking | Status | |
---|---|---|
firefox118 | --- | fixed |
People
(Reporter: twisniewski, Assigned: jfkthame)
References
(Blocks 1 open bug)
Details
(Keywords: dev-doc-complete)
Attachments
(5 files)
Chrome implementation bug: https://bugs.chromium.org/p/chromium/issues/detail?id=277215
Supporting this would let us pass these interop2023 WPTs:
Updated•5 months ago
|
Assignee | ||
Comment 1•5 months ago
|
||
We have support for this behind a pref, but last I checked, there was some lack of clarity about exactly what the values should be. We should look into that again, and see if there's a solid enough spec to move forward, or potentially push back against this being part of interop-2023 if the spec isn't ready.
Assignee | ||
Comment 2•4 months ago
|
||
Without the explicit USE_TYPO_METRICS flag, it's unclear whether metrics should be derived
from the font's 'OS/2' table's sTypo* fields, its usWin* fields, or the separate 'hhea' table,
and the values are quite different. (And legacy behavior varies among applications/platforms.)
Setting this flag is recommended by the OpenType spec to provide an unambiguous signal that
the OS/2 "typographical metrics" fields should be used, and so improves the chance of
getting reliably interoperable results.
Note that this means the fontBoundingBox test expectations need to be updated to reflect
the use of the sTypo* metrics fields to determine ascent/descent.
https://learn.microsoft.com/en-gb/typography/opentype/spec/os2#fsselection
Updated•4 months ago
|
Assignee | ||
Comment 3•4 months ago
|
||
The CanvasTest font's metrics indicate that its ascent is 75% of the em-size, and descent is 25%.
But using a font-size of 50px means these will be fractional-pixel dimensions, which introduces
the possibility of rounding resulting in minor discrepancies.
Changing the font-size to 40px allows the resulting ascent and descent to be integer values that
can more reliably be tested/compared.
Depends on D184605
Assignee | ||
Comment 4•4 months ago
|
||
Trying to enable this, I noticed that we're returning it with the wrong sign;
it's expected to be measured positive-downwards.
Depends on D184606
Assignee | ||
Comment 5•4 months ago
|
||
Depends on D184607
Assignee | ||
Comment 6•4 months ago
|
||
Depends on D184608
Assignee | ||
Comment 7•4 months ago
|
||
Note that patch 1 here modifies the existing CanvasTest font, and affects other tests that use it. I've opened https://github.com/web-platform-tests/interop/issues/386 about this change.
Pushed by jkew@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/81d8c94a76f7 patch 1 - Update the CanvasTest font to use OS/2 table version 4, with the USE_TYPO_METRICS flag set in the fsSelection field. r=gfx-reviewers,lsalzman https://hg.mozilla.org/integration/autoland/rev/4f1878e8cb86 patch 2 - Adjust font-size used in 2d.text.measure.emHeights tests to avoid rounding issues for fractional-pixel metrics. r=gfx-reviewers,lsalzman https://hg.mozilla.org/integration/autoland/rev/110166695d5e patch 3 - Fix sign error when returning canvas2d TextMetrics.emHeightDescent. r=gfx-reviewers,lsalzman https://hg.mozilla.org/integration/autoland/rev/b61d00e3d775 patch 4 - Expose the TextMetrics.emHeight{Ascent,Descent} attributes for Canvas2D text. r=gfx-reviewers,lsalzman https://hg.mozilla.org/integration/autoland/rev/90b19e0d07e5 patch 5 - Add testcases for emHeights and fontBoundingBox where the font's typographic ascent+descent does not equal the em size. r=gfx-reviewers,lsalzman
Comment 9•4 months ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/81d8c94a76f7
https://hg.mozilla.org/mozilla-central/rev/4f1878e8cb86
https://hg.mozilla.org/mozilla-central/rev/110166695d5e
https://hg.mozilla.org/mozilla-central/rev/b61d00e3d775
https://hg.mozilla.org/mozilla-central/rev/90b19e0d07e5
Failed to create upstream wpt PR due to merge conflicts. This requires fixup from a wpt sync admin.
Comment 11•4 months ago
|
||
The browser compat data for this needs to be updated. So adding the dev-doc-needed
flag.
Sebastian
Updated•4 months ago
|
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/41364 for changes under testing/web-platform/tests
Upstream PR merged by moz-wptsync-bot
Updated•4 months ago
|
Updated•4 months ago
|
Comment 14•3 months ago
|
||
FF118 Docs work for this done/tracked in https://github.com/mdn/content/issues/28852
Description
•