mirror of
https://github.com/Zakkaus/doona.git
synced 2026-12-06 08:02:04 +00:00
The @font-face rules point at fonts/, which only the optional doona-fonts archive provides, so a UI installed without it requested every Noto slice its text needed and logged a 404 for each. src/fonts.ts now fetches fonts/README once per page load and attaches fonts.css and the language's fonts-tc.css or fonts-sc.css only when it answers. main.tsx starts the check at module load so it overlaps the catalogue fetch, and the catalogue still resolves after its faces are declared and the Latin slice loaded, as it was from the first paint when the faces sat in the page's stylesheet; with font-display: optional, text laid out before the slice arrives keeps the system font. With the archive the faces, unicode ranges and per-glyph loading are unchanged. The probe is a GET so the service worker caches it for offline starts, and its body is read so a worker-relayed response does not hold the request open. The worker no longer caches an HTML response for a build file, so a host that answers missing paths with the page cannot pin the probe to "absent" after the archive is installed.
13 lines
2.5 KiB
CSS
13 lines
2.5 KiB
CSS
/* Self-hosted Noto Sans TC and SC subsets (Fontsource variable packages, OFL) so every machine renders CJK the same way; the metric
|
|
overrides centre ideograph ink in controls.
|
|
`optional` rather than `swap`: a subset that arrives after the first paint would re-measure every label and shift
|
|
table columns sideways. The service worker caches each subset as it is fetched, so from the second visit the
|
|
fonts are in place before the page renders in its language and are used. Only the Latin, Cyrillic and Vietnamese faces are here,
|
|
for every language; the ideograph subsets are in fonts-tc.css and fonts-sc.css, declared with the zh-TW and
|
|
zh-CN catalogues, before the page renders in either. src/fonts.ts attaches all three only when the optional font
|
|
archive is installed. */
|
|
@font-face { font-family: 'Noto Sans TC'; font-style: normal; font-weight: 100 900; font-display: optional; src: url(@fontsource-variable/noto-sans-tc/files/noto-sans-tc-cyrillic-wght-normal.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; ascent-override: 100%; descent-override: 20%; line-gap-override: 0%; }
|
|
@font-face { font-family: 'Noto Sans TC'; font-style: normal; font-weight: 100 900; font-display: optional; src: url(@fontsource-variable/noto-sans-tc/files/noto-sans-tc-vietnamese-wght-normal.woff2) format('woff2'); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; ascent-override: 100%; descent-override: 20%; line-gap-override: 0%; }
|
|
@font-face { font-family: 'Noto Sans TC'; font-style: normal; font-weight: 100 900; font-display: optional; src: url(@fontsource-variable/noto-sans-tc/files/noto-sans-tc-latin-ext-wght-normal.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; ascent-override: 100%; descent-override: 20%; line-gap-override: 0%; }
|
|
@font-face { font-family: 'Noto Sans TC'; font-style: normal; font-weight: 100 900; font-display: optional; src: url(@fontsource-variable/noto-sans-tc/files/noto-sans-tc-latin-wght-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; ascent-override: 100%; descent-override: 20%; line-gap-override: 0%; }
|