Closed Bug 1629787 Opened 5 years ago Closed 5 years ago

from-font keyword for text-underline-position should take MVAR `unds` `undo` into account

Categories

(Core :: Layout: Text and Fonts, defect, P3)

defect

Tracking

()

VERIFIED FIXED
mozilla77
Tracking Status
firefox77 --- verified

People

(Reporter: drott, Assigned: jfkthame)

Details

Attachments

(3 files)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.92 Safari/537.36

Steps to reproduce:

I am working on implementing text-underline-position from-font keyword support in Chromium and added a new test case, comparing a static font's underline position with a variable font's underline position in a reftest.

I tried running https://wpt.fyi/results/css/css-text-decor/text-underline-position-from-font-variable.html?sha=a4482f355e&label=master&max-count=1 in Firefox.

Actual results:

Test failed.

Expected results:

Test should pass.

The variable fonts MVAR table contains variable metrics unds and undo for underline size and offset. The user agent should extract these according to axis parameters set from font-variation-settings and apply the underline offset that is set in the variable font if the text-underline-position style is set to value from-font.

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → Layout: Text and Fonts
Product: Firefox → Core
Attached image Variable font underline in Safari (deleted) —

Good point. Firefox has historically used the underline position/thickness values from the font as its default behavior, but that long predates variable fonts, and we haven't updated to take account of that.

Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P3

Thanks for the quick triage.

So it turns out this does work on Windows and Linux, because we get the underline metrics through APIs (DirectWrite and FreeType respectively) that handle the variation. (The example doesn't currently work in Firefox on these platforms, but that's because the testcase is faulty: https://github.com/web-platform-tests/wpt/issues/22944. With that fixed, it works as expected.)

But it is indeed a bug on macOS, where we read the values from the OS/2 table directly. So we need to fix that here.

Assignee: nobody → jfkthame
Status: NEW → ASSIGNED
Pushed by jkew@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/346767fe3f90 Initialize font metrics via harfbuzz API rather than reading tables directly, so that variations are respected. r=lsalzman
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla77

From report to fix in ~2 days, with a complex code change to make that happen. Thank you, Jonathan, great work!

Flags: qe-verify+

Reproduced the issue on Firefox 77.0a1 (20200414214610) on MacOS 10.15
Verified - fixed on Firefox 77.0a1 (20200415215103)

Status: RESOLVED → VERIFIED
Flags: qe-verify+
Regressions: 1769326
No longer regressions: 1769326
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: