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

RESOLVED FIXED in Firefox 61



Last year
Last year


(Reporter: jfkthame, Assigned: jfkthame)


Dependency tree / graph

Firefox Tracking Flags

(firefox61 fixed)



(1 attachment, 1 obsolete attachment)

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
(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
Make enabling of font-variation-settings and font-optical-sizing properties dependent on adequate platform support at runtime. r=lsalzman
Closed: Last year
Resolution: --- → FIXED
Target Milestone: --- → mozilla61
You need to log in before you can comment on or make changes to this bug.