-
Notifications
You must be signed in to change notification settings - Fork 756
Description
When a web author doesn't want to pay any CLS for web fonts, but still want the font to be used with a big enough chance, there's a trick of combining (example example):
- A preload of the font file (
<link rel=preload>) - Setting the
font-displaydescriptor value tooptional
It makes the web font acts similar to a local font that:
- If the font loads fast enough, then we never use fallback fonts, which is similar to a successful load of a local font
- If the font loads slow to fails, then we end up using fallback, which is similar to a failed load of a local font
However, the trick is pretty unintuitive. Preload indicates that the font is important, yet font-display: optional means the font is not so important. It can be very confusing (example).
So I'm filing this issue to investigate a more intuitive version.
Idea: A new font-display value that does the same? As soon as we see it in a stylesheet, we kick off a preload of the font, and block rendering before the preload finishes or a timeout (e.g., 50ms); And the font enters the failure font display period as long as any fallback has been used.
Also note that in Chrome, we've already implemented this behavior when preloading and font-display: optional are used together.