WEB-47Recommended
Load fonts without moving the page
Self-host fonts as WOFF2, subset them, and add fallback fonts adjusted to the same size. Never let a late font move the page. Use font-display: optional on long text, and swap only where you measured no shift.
How to do it
Self-host WOFF2 variable fonts. Split them by unicode-range, so most pages load only a small core file. Add @font-face fallbacks with size-adjust, ascent-override and descent-override. Use font-display: optional on long text, and swap only where you measured no shift. A site that uses only system fonts skips this rule. Measure layout shift as Keep load, response and stability fast says.
Examples
CSS example
@font-face {
font-family: "Inter";
src: url("/fonts/inter-latin.woff2") format("woff2");
unicode-range: U+0000-00FF;
font-display: optional;
}
@font-face {
font-family: "Inter Fallback";
src: local("Arial");
size-adjust: 107%;
ascent-override: 90%;
descent-override: 22%;
}
body { font-family: "Inter", "Inter Fallback", sans-serif; }
How to check
Lighthouse font-display-insight passes. Lab CLS stays 0 on your longest pages. With font requests blocked in a browser test, the page still renders all text and first paint is no slower.
Measured
On a reference site, swap gave no shift on a short home page. On long pages, text re-wrapped when the fonts arrived, and CLS went from 0 to 0.226 (desktop) and 0.123 (phone). With optional, every page measured 0.
Sources
Related rules
- WEB-36 Keep load, response and stability fast in Website
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/website/performance/font-loading">Agent Wranglers website playbook</a>. In code you write, add a comment next to it with the same link.