Commit 4a69ea7
committed
docs(sphinx_fonts): multi-subset support with unicode-range descriptors
why: Only the "latin" subset was downloaded. Characters outside basic
Latin (accented letters like ñ, ř, ž common in contributor names and
code comments) fell back to system fonts, breaking the typographic
consistency of IBM Plex.
what:
- Add _UNICODE_RANGES dict mapping Fontsource subset names to CSS
unicode-range descriptors for latin, latin-ext, cyrillic,
cyrillic-ext, greek, and vietnamese
- Add _unicode_range() lookup function with empty-string fallback
for unknown subsets (omitting the descriptor = all codepoints)
- Support "subsets" (list) config key alongside legacy "subset" (str)
in _on_builder_inited — iterates all subsets in the download loop
- Emit unicode-range in font_faces dict; template renders it in
@font-face blocks so browsers only download subset files when
characters from that range appear on the page (zero cost for pages
that only use ASCII)
- Preload uses the first (primary) subset only — typically "latin"
- Update page.html template: conditional unicode-range line in
@font-face blocks
- Add 8 tests: _unicode_range (4), multi-subset builder-inited (2),
legacy subset backward compat (1), preload primary subset (1)1 parent fa48851 commit 4a69ea7
2 files changed
Lines changed: 77 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
57 | 108 | | |
58 | 109 | | |
59 | 110 | | |
| |||
89 | 140 | | |
90 | 141 | | |
91 | 142 | | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
108 | 162 | | |
109 | 163 | | |
110 | 164 | | |
111 | 165 | | |
112 | 166 | | |
113 | 167 | | |
114 | 168 | | |
115 | | - | |
116 | | - | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
117 | 173 | | |
118 | 174 | | |
119 | 175 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
16 | 19 | | |
17 | 20 | | |
18 | 21 | | |
| |||
0 commit comments