Loading fast: critical path, hints, images, fonts, caching · mid
Web fonts without slow text or layout shifts
Web fonts can hide text (slow FCP/LCP) or swap late (CLS); you control this with font-display, early discovery (preload with crossorigin or inline @font-face), smaller files (WOFF2, subsets) and fallback fonts tuned with size-adjust.
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceThe notes
What you must know
- font-display: block hides text for up to about 3 s; swap shows fallback text at once and swaps later (best for FCP, but can shift); fallback = 100 ms block + 3 s swap window; optional = 100 ms block and no late swap (no shift, but the web font may not show on the first visit).
- Fonts are discovered late (only after CSS is parsed and text needs them). Inline the @font-face rules or preload the one or two most important files, with crossorigin.
- Use WOFF2 (about 30% smaller than WOFF). Subset to the scripts you need (Latin, Devanagari, Gujarati) and use unicode-range so other subsets load only if needed.
- Reduce swap CLS by matching the fallback's metrics: @font-face with size-adjust, ascent-override, descent-override on a local fallback (next/font does this for you).
- Self-hosting is not always faster than a font service; self-hosting on your CDN with HTTP/2+ usually avoids an extra connection.
- Fewer font files: a variable font can replace many weight files.
The red pen
Common traps: mistake → fix
Mistake: "font-display: swap fixes everything"
Fix: swap improves FCP but can cause CLS when the font swaps; tune the fallback or use optional.
Mistake: "Preload fonts without crossorigin"
Fix: the preload is not reused and the font downloads twice.
Mistake: "Load every weight and script just in case"
Fix: each file costs bytes and delays text.
Easy to hard
Questions interviewers ask, easy to hard
- What does font-display do? Compare swap and optional.
- How can web fonts hurt LCP and CLS?
- How would you load fonts for a site in English, Hindi and Gujarati?
- What does next/font do under the hood?
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceYour first interview is free
Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.