Closed Bug 1451296 Opened 6 years ago Closed 6 years ago

Make support for font-variation-settings and font-optical-sizing dependent on adequate platform support for variable fonts

Categories

(Core :: Graphics: Text, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla61
Tracking Status
firefox61 --- fixed

People

(Reporter: jfkthame, Assigned: jfkthame)

References

Details

Attachments

(1 file, 1 obsolete file)

Currently, these CSS properties appear as supported whenever the layout.css.font-variations.enabled pref is set to true.

However, in practice this feature only works when running on a sufficiently recent platform. On older versions of Windows or macOS, or on Linux with an older FreeType library, variation fonts will work unreliably, incorrectly, or not at all. See e.g. bug 1450057, bug 1451266.

Because it is really misleading for websites if @supports claims that font-variation-settings is supported, yet there is no real implementation (because the platform is too old), I think it would be better to make these properties conditional on not only the existing layout.css.font-variations.enabled pref, but also on a runtime gfxPlatform query that tests whether we can support variable fonts on the current platform.

So if the platform says "no, I can't do that", the CSS properties will remain disabled regardless of the setting of layout.css.font-variations.enabled, and sites that use @supports will be able to handle fallback appropriately.

For Windows, it's easy: only Fall Creators Update or later supports variations.

For macOS, there has been variation font support in Core Text for some time, but older versions are known to be fairly buggy. I'm proposing to support only 10.12 or later.

For Linux, the installed FreeType version is the key. Local testing suggests that 2.7.1 (released at the end of 2016) is a reasonable cut-off. There was some multiple-master/variation font support present in earlier versions, but there have been enough recent bug-fixes, including ones that directly affect our usage, that enabling it on earlier releases is not helpful.

(On Android, we use in-tree FreeType, so we know we're getting a recent version.)
Something like this should work, AFAICT: if the platform isn't able to support variation fonts, force the pref to false at startup, and lock it. (This will require metadata updates for a number of tests, because we currently don't have new enough FreeType on our Linux CI configurations.) :(
Assignee: nobody → jfkthame
Status: NEW → ASSIGNED
(Moving this to Graphics:Text; although it affects the exposure of CSS properties, it's really more of a gfx platform patch.)
Component: CSS Parsing and Computation → Graphics: Text
Attachment #8964905 - Attachment is obsolete: true
Attachment #8965268 - Flags: review?(lsalzman) → review+
Pushed by jkew@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/ebeb68db4cb5
Make enabling of font-variation-settings and font-optical-sizing properties dependent on adequate platform support at runtime. r=lsalzman
https://hg.mozilla.org/mozilla-central/rev/ebeb68db4cb5
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla61
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: