Repository navigation
feat(web): self-host the Inter and JetBrains Mono brand fonts - #4341
Conversation
tokens.css names Inter and JetBrains Mono, but nothing loaded them, so every site rendered in system fonts. Ship both as latin-subset variable woff2 files in @wheels-dev/ui with font-display: swap, imported from tokens.css so every site that uses the tokens gets them. No third-party font request. OFL license texts sit next to the files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review @ 1ee218f: APPROVE on content (web/ui). Merge gated on PR CI, with the baseline refresh below
INFO (optional):
Baselines: once you've confirmed the visual diff is font-only and the bot refreshes "all", that bot commit runs no checks ( |
|
rev1-r3 review @ 1ee218f: code APPROVE (final sign-off after PR CI, including the visual-regression run and your font-only diff check)
The visual baselines are expected to change, as the body says. If the refresh workflow pushes new baseline images to this branch, please send me the new head. I'll confirm the delta is baseline images only before the final. |
Manually triggered baseline refresh via .github/workflows/refresh-visual-baselines.yml targeting branch peter/web-self-host-fonts. Run when an intentional content/layout change makes the visual-regression check fail. The new PNG(s) under web/tests/visual-baselines/ are now the expected rendering.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Re-ack @ 1926f62: APPROVE. The only changes since 1ee218f are the bot's |
|
rev1-r3 review @ 1926f62: APPROVE (final; PR CI checked)
|
Summary
web/packages/ui/src/styles/tokens.csssets--font-sans: 'Inter', …and--font-mono: 'JetBrains Mono', …, but nothing inweb/loaded either font. There was no@font-face, no font package, and no webfont link. So every site rendered in the fallback system fonts, unless a visitor happened to have Inter or JetBrains Mono installed. Inter and JetBrains Mono are the intended design, so this PR loads them.Changes
web/packages/ui/src/assets/fonts/: the two font files and their licenses.inter-latin-wght-normal.woff2(48 KB) andjetbrains-mono-latin-wght-normal.woff2(40 KB): the Latin subset as variable fonts covering weights 100 to 900. The sites use 400, 500, 600 and 700.Inter-OFL.txt,JetBrainsMono-OFL.txt).web/packages/ui/src/styles/fonts.css(new): two@font-facerules using the family names the tokens already use ('Inter','JetBrains Mono'),font-display: swap, and the Latinunicode-range. Exported as@wheels-dev/ui/styles/fonts.css.tokens.cssgains@import './fonts.css';, so every site that loads the tokens gets the fonts with no per-site edit. That covers the landing, blog and packages layouts, and guides and API through Starlight, whose--sl-font/--sl-font-monomap to our tokens.There's no third-party font request, and no new npm dependency. Fontsource's packages were tried first, but their
exportsmap rewrites./*to./*.css, so CSS can't point at theirwoff2files. Importing their full CSS instead would ship every subset.Verification
pnpm build(all sites): landing 1, blog 357 and packages 8 pages built, and guides and API complete. Each site'sdist/_astro/contains both font files, and its CSS has@font-face{font-family:Inter;…font-display:swap;font-weight:100 900;src:url(/_astro/inter-latin-wght-normal.….woff2)…}.WHEELS_DOCS_BASE=/wheels/guides/, the guides build emitssrc:url(/wheels/guides/_astro/inter-latin-wght-normal.….woff2), correctly prefixed for the bundle the framework serves.prettier --checkis clean.Visual baselines
Every site's text now renders in Inter and JetBrains Mono, so every visual baseline is expected to change. After CI's visual-regression run, I'll check the diff artifact. If it shows only the font change, I'll refresh the baselines with the "Refresh visual baselines" workflow (
all) on this branch.🤖 Generated with Claude Code