Closed
Bug 1394236
Opened 7 years ago
Closed 7 years ago
Kerning is not applied to `-apple-system` font
Categories
(Core :: Layout: Text and Fonts, defect)
Tracking
()
RESOLVED
FIXED
mozilla57
Tracking | Status | |
---|---|---|
firefox57 | --- | fixed |
People
(Reporter: kennytm, Assigned: jfkthame)
References
Details
Attachments
(3 files)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:57.0) Gecko/20100101 Firefox/57.0 Build ID: 20170827100428 When using the `-apple-system` font, kerning between letter seems not applied at all. This makes the letter spacing of paragraphs that uses the native font stack looked very strange. Steps to reproduce: 1. Download the attached `1.html`. 2. Open it in Firefox. Also open it in Safari. 3. Compare the rendered result. Expected: * Both browsers rendered the same (normal: 485px, bold: 507px). Actual: * Firefox consistently rendered the text wider than Safari (normal: 509px, bold: 531px). (Real world example: any GitHub page like https://github.com/twbs/bootstrap/issues) ---- * Same bug for Chrome: https://bugs.chromium.org/p/chromium/issues/detail?id=627609, which linked to the HarfBuzz issue https://github.com/behdad/harfbuzz/issues/360 * I think fixing bug 1349308 makes the rendering worse compared to Firefox 54, since the lack of kerning is even more prominent. ---- Tested on: * Firefox 55.0.3 and Firefox Nightly 57.0a1 (2017-08-27), both looked the same * macOS Sierra 10.12.6
Updated•7 years ago
|
Component: Untriaged → Layout: Text
Product: Firefox → Core
Assignee | ||
Comment 2•7 years ago
|
||
So there are two interesting points here. (Ignoring the incorrect spacing of the bold font in Firefox 54, where it was much too tight.) One is that no kerning is being applied to the -apple-system font (SFNS Text or SFNS Display, depending on size); this can be seen by looking at the initial "Tr" in the screenshots. The second is the difference between the tracking seen in the Safari rendering vs Firefox/Chrome. I think this is because we don't apply the AAT tracking feature that adjusts inter-glyph spacing according to font size. So in Firefox, the text scales linearly (e.g. at 16px, the width of the text will be twice what it is at 8px) until the switch to the Display face occurs; whereas in Safari, the scaling is non-linear (16px text is significantly less than twice the width of 8px text, because of tighter tracking).
Assignee | ||
Comment 3•7 years ago
|
||
The failure to apply kerning is because we use harfbuzz to shape the SFNS Text/Display faces, but harfbuzz does not currently support Apple's 'kerx' table format. So we can fix this by detecting the presence of this table and delegating shaping to the Core Text codepath instead. I'll post a patch for this. Even when we use Core Text to shape the font, however, we don't seem to get the same tracking as Safari shows. I'm not sure why this is... further investigation may be required there. I think we should handle that in a separate followup bug. (Or maybe support will be added within harfbuzz, and we can just adopt that.)
Assignee | ||
Comment 4•7 years ago
|
||
Attachment #8905607 -
Flags: review?(jmuizelaar)
Assignee | ||
Updated•7 years ago
|
Assignee: nobody → jfkthame
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Comment 5•7 years ago
|
||
Comment on attachment 8905607 [details] [diff] [review] For Apple fonts that include a 'kerx' table, prefer the Core Text shaping path so that we get kerning support Review of attachment 8905607 [details] [diff] [review]: ----------------------------------------------------------------- Any chance of harfbuzz supporting 'kerx' tables?
Assignee | ||
Comment 6•7 years ago
|
||
Perhaps some day -- Behdad has talked of supporting the other AAT tables, too -- but I don't expect to see anything in the immediate future.
Updated•7 years ago
|
Attachment #8905607 -
Flags: review?(jmuizelaar) → review+
Pushed by jkew@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/bd81dcf6af60 For Apple fonts that include a 'kerx' table, prefer the Core Text shaping path so that we get kerning support. r=jrmuizel
Comment 8•7 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/bd81dcf6af60
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
status-firefox57:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
You need to log in
before you can comment on or make changes to this bug.
Description
•