Commit d7e7d32
Switch font-display to fallback + metric-matched fallback faces
Replace font-display: optional with fallback across dev and prod.
Optional's 100ms race locks in system-font rendering for the whole
page load on any cold cache — this is what hid the new Smoke-page
characters on live for first-time visitors.
To keep CLS at zero when the real webfont swaps in, emit a paired
'<Family> Fallback' @font-face for each active Huiwen face. It wraps
local('Songti SC'/'FangSong'/...) with ascent-override, descent-
override, and line-gap-override read from the real TTF's OS/2 table,
so the fallback occupies the same line box as the webfont. Cascade
chains in tokens.css now place the Fallback face between the webfont
and raw system fonts.
- scripts/build-fonts.py: FALLBACK_SYSTEM_FONTS map, _metric_overrides
reads OS/2 sTypoAscender/sTypoDescender/sTypoLineGap, emits CSS
percentages; _fallback_face_css builds the proxy @font-face; both
dev and prod pipelines include the Fallback faces.
- src/styles/tokens.css: insert 'Huiwen Mincho Fallback' and
'Huiwen Fangsong Fallback' into the two fallback chains.
- public/fonts-dev.css + public/fonts/dev/*.woff2: regenerated output.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent f44954b commit d7e7d32
5 files changed
Lines changed: 75 additions & 8 deletions
File tree
- public
- fonts/dev
- scripts
- src/styles
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
21 | | - | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
| 27 | + | |
| 28 | + | |
Binary file not shown.
Binary file not shown.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
67 | 79 | | |
68 | 80 | | |
69 | 81 | | |
| |||
115 | 127 | | |
116 | 128 | | |
117 | 129 | | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
118 | 165 | | |
119 | 166 | | |
120 | 167 | | |
| |||
142 | 189 | | |
143 | 190 | | |
144 | 191 | | |
145 | | - | |
| 192 | + | |
146 | 193 | | |
147 | 194 | | |
148 | 195 | | |
149 | 196 | | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
150 | 200 | | |
151 | 201 | | |
152 | 202 | | |
| |||
251 | 301 | | |
252 | 302 | | |
253 | 303 | | |
254 | | - | |
| 304 | + | |
255 | 305 | | |
256 | 306 | | |
257 | 307 | | |
| |||
307 | 357 | | |
308 | 358 | | |
309 | 359 | | |
310 | | - | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
311 | 364 | | |
312 | 365 | | |
313 | 366 | | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
314 | 370 | | |
315 | 371 | | |
316 | 372 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
40 | 47 | | |
41 | | - | |
| 48 | + | |
42 | 49 | | |
43 | | - | |
| 50 | + | |
44 | 51 | | |
45 | 52 | | |
46 | 53 | | |
| |||
0 commit comments