Summary: For a given "font size" as expressed e.g. in CSS px or points, different fonts can vary significantly in how visually large they look. The nominal "font size" does not necessarily relate to any specific dimension of the glyphs; it sizes the coordinate space within which the glyph shapes are drawn, but different designs may fill that space in very different ways.

The proposed glyph-scale-factor descriptor (name to be bikeshedded) will allow authors to adjust the scaling of individual fonts loaded using @font-face, to better harmonize the visual sizes of different designs, or to more closely match a fallback face to a resource that may be swapped in later, thereby minimizing visual layout shift when the final font becomes available.

Unlike modifying the font-size property, this will scale the glyphs (and metrics) of the font but will *not* affect things like the CSS 'em' unit. It affects how glyphs scale within the font's em square, not the size of the em square itself.

Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1698495

Standard: This is currently under discussion for CSS Fonts 5; details still to be worked out. See https://github.com/w3c/csswg-drafts/issues/6075.

Platform coverage: All

Preference: layout.css.glyph-scale-factor.enabled

DevTools bug: None needed. (More generally, it would be awesome to have a @font-face rule inspector in DevTools -- distinct from the existing font *properties* inspector; such an inspector would expose this along with the other @font-face descriptors. But that's not specific to this new descriptor.)

Other browsers:
Blink: Considering (already experimented with possible implementation, see https://github.com/w3c/csswg-drafts/issues/5533#issuecomment-714166725).
Webkit: Present in CSS WG discussions but no clear signals yet AFAIK.

web-platform-tests: To be added to web-platform/tests/css/css-fonts (as .tentative initially, until spec is finalized).

_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to