Files
doona/docs/fonts.md
T
Zakk dcb6d92b4a fix(fonts): declare the Noto faces only when the font archive is installed
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.
2026-10-04 06:18:13 +11:00

1.8 KiB
Raw Blame History

Fonts

Noto Sans TC and Noto Sans SC are bundled from @fontsource-variable/noto-sans-tc and @fontsource-variable/noto-sans-sc. Their font name tables credit Copyright 2014–2021 Adobe, with Reserved Font Name “Source”. They use the SIL Open Font License 1.1.

src/fonts.css, src/fonts-tc.css and src/fonts-sc.css reference the packages' WOFF2 files directly. The local @font-face declarations preserve the family names, variable weight range (100–900), font-display: optional, metric overrides and unicode ranges. The TC and SC stylesheets load with their language catalogues; the browser fetches only the slices needed for the page's text. No CDN or external font request is used.

Vite emits the referenced files with content hashes under dist/fonts/. These files remain outside the service worker's shell precache and are cached on first use. The release's optional font archive contains this directory, including OFL.txt and this document as README. The UI requests fonts/README once per page load and attaches the @font-face stylesheets only when it answers, so without the archive nothing under fonts/ is requested and the application's font fallbacks apply.

When updating the packages, compare their index.css unicode ranges with the local declarations and retain the Latin faces at the end of fonts-tc.css: they take precedence over overlapping ideograph slices.

Segmented-control labels use regular weight (400). At 14px and 1× device scale, Noto Sans TC's medium-weight strokes merge inside dense ideographs such as 直; regular weight keeps the counters open without changing the font size or falling back to a different font.