Web: Chinese UI loads a Chinese font (#8894) (#8981)

* claim: #8894

Co-authored-by: Cursor <cursoragent@cursor.com>

* Web: load Simplified/Traditional Chinese fonts for zh and zh-TW (#8894)

BIZ UDPGothic only covers Japanese, so Chinese UI showed tofu. Ship locale-glyph Craft UI SC/TC subsets and fetch the matching face on demand.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
SilentWolf75
2026-10-30 13:33:23 +00:00
committed by GitHub
parent 8b25fa0ae4
commit 21340ba019
11 changed files with 436 additions and 81 deletions
+6
View File
@@ -173,6 +173,12 @@ fn render(root: &Path, crates: &[Crate]) -> String {
- BIZUDPGothic-Regular.ttf (assets/fonts/biz-udp-gothic/BIZUDPGothic-Regular.ttf)\n \
Copyright 2022 The BIZ UDGothic Project Authors (https://github.com/googlefonts/morisawa-biz-ud-mincho)\n \
Source: https://github.com/googlefonts/morisawa-biz-ud-gothic\n\n\
- CraftUI-SC.otf (assets/fonts/craft-ui-sc/CraftUI-SC.otf)\n \
Copyright 2014-2021 Adobe / Google Inc. (Noto Sans SC subset for SolidCraft web zh)\n \
Source: https://github.com/notofonts/noto-cjk (Sans SubsetOTF/SC)\n\n\
- CraftUI-TC.otf (assets/fonts/craft-ui-tc/CraftUI-TC.otf)\n \
Copyright 2014-2021 Adobe / Google Inc. (Noto Sans TC subset for SolidCraft web zh-TW)\n \
Source: https://github.com/notofonts/noto-cjk (Sans SubsetOTF/TC)\n\n\
- IBMPlexSans-Variable.ttf (assets/fonts/ibm-plex-sans/IBMPlexSans-Variable.ttf)\n \
Copyright 2017 IBM Corp. with Reserved Font Name \"Plex\"\n \
Source: https://github.com/IBM/plex\n\n\
+3 -3
View File
@@ -19,9 +19,9 @@ use sha2::{Digest, Sha256};
const MARKER: &str = "/* @build */";
const SW: &str = "sw.js";
const BUILD: &str = "build.json";
/// Files the app fetches only when it needs them (the CJK font, ~4.7 MB: `JAPANESE_FONT_PATH`
/// in apps/solidcraft-web/src/main.rs): not kept for offline use, so not every user downloads
/// them. The worker leaves them to the network.
/// Files the app fetches only when it needs them (Japanese ~4.7 MB and Chinese subsets under
/// `fonts/` in apps/solidcraft-web): not kept for offline use, so not every user downloads them.
/// The worker leaves them to the network.
const ON_DEMAND: &[&str] = &["fonts/"];
/// The version that makes sw.js retire (the template's own).
const RETIRE_VERSION: &str = "dev";