Re: [csswg-drafts] [css-fonts-4] font-display: optional without relayout (#4108)

> > The font needs to always be loaded, regardless of whether it applies to any elements on the page. This is necessary to avoid extra, inefficient forced style or layouts, and allow the fetch (either from cache or network) to start as soon as the font element is parsed. This also is needed to mitigate the "blocks all rendering" behavior of item 2 above.
> 
> I think this is an explicit anti-goal of this value; an "optional" font that is instead eagerly pre-loaded immediately on page load isn't very optional, I think. ^_^ Note the other functionality attached to the value, allowing the UA to abort the font load entirely if they know they're on a low-bandwidth connection, for example. An "optional" font is _explicitly intended_ to be unreliable; the feature is aimed at being maximally friendly to users at the expense of authors' design preferences.

How should a UA decide whether/when to load a `font-display: optional` font?

According to the [font loading guidelines](https://drafts.csswg.org/css-fonts-4/#font-face-loading), UA should "download" a font only when "used within a document". However, we can't know whether a font is used without actually rendering the document. And if we render the document, we are basically violating the "no relayout" requirement of `optional`. Even if we don't deliver the frame (so that layout doesn't jump), we are still introducing extra latency that we want to avoid.

So If authors want to ensure no extra rendering while maximizing the chance that the font is used, do they have to force loading it with Font Loading API or `<link rel="preload">`, in combination with `optional`?

(Or do words "download" and "load" have different meanings here?)

-- 
GitHub Notification of comment by xiaochengh
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4108#issuecomment-573186259 using your GitHub account

Received on Friday, 10 January 2020 20:06:56 UTC