# Self-hosted web fonts

`../google-fonts.css` + the `*.woff2` files here provide **Fraunces** (titles) and
**Inter Tight** (mono) fully offline, so `editor.html` never references
`fonts.googleapis.com`. That host is blocked / very slow on many mainland-CN
networks; as a render-blocking `<link>` it previously froze the editor on a blank
white screen for ~75 s until the connection timed out.

The CSS still lists system-font fallbacks (`-apple-system`, `Iowan Old Style`,
`SF Mono`, …), so missing files degrade gracefully rather than breaking layout.

## Re-fetching (only if the font selection changes)

Google Fonts itself is unreachable here, so download via a CN mirror
(`fonts.loli.net` → `gstatic.loli.net`). Use a modern desktop UA to get `woff2`:

```bash
UA='Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36'
Q='css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,500;0,9..144,600;1,9..144,400&family=Inter+Tight:wght@400;500;600&display=swap'

# 1. fetch the CSS
curl -sS -A "$UA" "https://fonts.loli.net/$Q" -o /tmp/gfonts.css

# 2. download every woff2 into this directory
grep -oE 'https://gstatic\.loli\.net/[^)]+\.woff2' /tmp/gfonts.css | sort -u \
  | while read -r u; do curl -sS -o "$(basename "$u")" "$u"; done

# 3. rewrite absolute mirror URLs to relative ../google-fonts.css references
perl -pe 's{https://gstatic\.loli\.net/[^)]*?/([^/)]+\.woff2)}{fonts/$1}g' \
  /tmp/gfonts.css > ../google-fonts.css
```

The mirror is only a download source — once the files are committed, runtime
serving is 100% local via the server's `/css/` static route.
