Skip to content

Commit 7088d0e

Browse files
committed
[css-fonts-4] Further clarify the behavior of 'optional' to stress that the important thing is to avoid layout jank at all costs. Fixes w3c#4108.
1 parent fca7c3e commit 7088d0e

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

css-fonts-4/Overview.bs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2792,22 +2792,25 @@ for example, forcing all fonts to have a ''0s'' <a>block period</a>.
27922792

27932793
<dt><dfn>optional</dfn>
27942794
<dd>
2795-
Gives the font face an extremely small <a>block period</a>
2796-
(''100ms'' or less is recommended in most cases)
2797-
and a ''0s'' <a>swap period</a>.
2795+
If the font can be loaded "immediately"
2796+
(such that it's available to be used for the "first paint" of the text),
2797+
the font is used.
27982798

2799-
If the font is not retrieved before the two durations expire,
2799+
Otherwise, the font is treated
2800+
as if its [=block period=] and [=swap period=] both expired before it finished loading.
2801+
If the font is not used due to this,
28002802
the user agent may choose to abort the font download,
28012803
or download it with a very low priority.
28022804
If the user agent believes it would be useful for the user,
28032805
it may avoid even starting the font download,
28042806
and proceed immediately to using a fallback font.
28052807

2806-
Note: In other words, the font is used if it's already downloaded and available,
2807-
but otherwise a fallback is used for the rest of the page's lifetime instead.
2808-
The font might download in the background and be available to future page loads,
2809-
but if the user-agent detects that the user has very limited bandwidth,
2810-
it might choose to simply never download and use the font.
2808+
An ''optional'' font <strong>must never</strong>
2809+
cause the layout of the page to "jump" as it loads in.
2810+
A user agent <em>may</em> choose to slightly delay rendering an element using an optional font
2811+
to give it time to load from a possibly-slow local cache,
2812+
but once the text has been painted to the screen with a fallback font instead,
2813+
it must not be rendered with the ''optional'' font for the rest of the page's lifetime.
28112814

28122815
This value should be used for body text,
28132816
or any other text where the chosen font is purely a decorative "nice-to-have".

0 commit comments

Comments
 (0)