Skip to content

fix(site): self-host fonts so text does not swap while loading - #13

Merged
lucasnevespereira merged 1 commit into
mainfrom
fix/site-fonts
Nov 14, 2026
Merged

lucasnevespereira merged 1 commit into
mainfrom
fix/site-fonts

Conversation

@lucasnevespereira

Copy link
Copy Markdown
Member

Summary

The landing visibly swapped fonts while loading: Google Fonts arrived after the first paint. Fonts are now served from the site, preloaded, and use font-display: optional.

-<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Fraunces…&family=Geist…&family=Geist+Mono…">
+<link rel="preload" href="assets/fonts/geist.woff2" as="font" type="font/woff2" crossorigin>
+<link rel="preload" href="assets/fonts/fraunces.woff2" as="font" type="font/woff2" crossorigin>
+<link rel="preload" href="assets/fonts/geist-mono.woff2" as="font" type="font/woff2" crossorigin>
@font-face { font-family: "Geist"; src: url("../../assets/fonts/geist.woff2") format("woff2"); font-weight: 400 600; font-display: optional; }

Three Latin variable files, 117 KB total, SIL Open Font License. The site is now served at inkssg.snowztech.com.

Evidence

  • Before: on a slow 3G profile, with preload and swap, fonts finished 715 ms after the first paint, so text changed font in front of the reader.
    After: with optional, layout shift is 0.0001 on both a normal and a slow 3G profile, and Geist, Geist Mono and Fraunces are in use on both.

Merge Danger

Door: two-way

Blast Radius: small

On a very slow first visit, a page can keep the fallback font for that view; the next page uses the cached font.

@lucasnevespereira
lucasnevespereira merged commit 4a5cca8 into main Nov 14, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant