Intent to prototype: glyph-scale-factor descriptor for @font-face rules

109 views
Skip to first unread message

Jonathan Kew

unread,
Mar 15, 2021, 8:39:36 AMMar 15
to dev-pl...@lists.mozilla.org
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).

一丝

unread,
Mar 15, 2021, 11:34:29 AMMar 15
to
It seems that this is more useful for emoji fonts, have you researched it?

Sebastian Zartner

unread,
Mar 17, 2021, 4:42:11 PMMar 17
to
If I'm not mistaken, the CSS WG ended up naming the descriptor 'size-adjust'. See https://github.com/w3c/csswg-drafts/pull/6108.

Sebastian
Reply all
Reply to author
Forward
0 new messages