fix(ui): Chinese and Korean letters are drawn by their own Windows font, not Japanese Yu Gothic's boxes #3152

Merged
HumanBean merged 3 commits from cuecuemoar/Longshot:fix/cjk-menu-fonts into main 2026-12-04 17:02:05 +00:00
Contributor

Summary

On Windows, the Insert menu in Simplified Chinese shows many letters as boxes ("画□□□", "□高比", "□出分辨率"), and in Korean every Hangul letter would be one. On main: set Game language to 简体中文 (Menu language Auto), press Insert, Graphics.

The UI (game/crates/ui/src/text.rs) read one system font for all of Han, Kana, Hangul and Bopomofo: the first file of its list found, which on Windows is always Yu Gothic (Japanese). Yu Gothic lacks many Simplified Chinese letters and every Hangul one, and Microsoft YaHei and Malgun Gothic after it in the list were never read.

This reads the first usable file for each CJK system font and gives each script and language its own first:

  • Hangul: Malgun Gothic. Kana: Yu Gothic. Bopomofo: Microsoft JhengHei.
  • Han by the text's language, the menu's: Simplified Chinese and any non-CJK language (fontique's default for Han, zh-CN) Microsoft YaHei; Traditional Chinese Microsoft JhengHei; Japanese Yu Gothic; Korean Malgun Gothic.
  • The others after it, so a letter the first lacks is looked up in the next.
  • Linux: the first usable Noto Sans CJK / Source Han file for every script.

The system's fonts are fontique's fallbacks only, no longer in the family list every text is given: that list is tried before any fallback, so a CJK font in it draws every language's Han and Kana (with the four fonts read, Microsoft YaHei would have drawn the Japanese menu). The texts get the menu's language as their locale: the UI thread sends Msg::FontLanguage when menu_lang() changes (game/crates/longshot-game/src/ui.rs), and the main thread's Measurer measures in it too (game/crates/api/src/services/ui.rs). A system font's bytes are read once for the process and shared by both.

Read first: game/crates/ui/src/text.rs CJK_FONTS, CJK_FALLBACKS, fallback_plan, fallbacks_from / register_fallback, then Fonts::set_language and props.

Fixes #3075

Testing

Tested: Windows 10, RTX 4090, driver 617.42, 2560x1440, keyboard and mouse; Insert menu, Graphics tab, Game language set in the run's settings, Menu language Auto.

  • main (299ed5b70's text code, unchanged on main since; #3149's runtime), Simplified Chinese: many letters are boxes ("画□□□", "□高比", "□出分辨率", "□生成与延□").
  • This PR (runtime v3.2.0-293-gd3be22ce1), Simplified Chinese: every letter drawn ("画质预设", "宽高比", "输出分辨率", "帧生成与延迟"); Korean: every Hangul letter drawn (Malgun Gothic); Japanese: kana and kanji drawn by Yu Gothic, as on main. No fault in any run's log.
  • Screenshots: in the comment below the first (main and this PR in Simplified Chinese, this PR in Korean and Japanese).

Checks (Linux, WSL Ubuntu 22.04):

  • cargo test -p game-ui --lib: on the test commit 4f807ec2e each_cjk_script_and_language_is_drawn_by_its_own_windows_font_first_the_others_after_it fails (Hangul: Malgun Gothic: Yu Gothic is Hangul's one font) and the_system_fonts_are_fallbacks_only_and_han_takes_its_language_s_first fails (the system's fonts are not in every text's family list); on 5e6cb633c 176 passed, 0 failed. The second test runs the real registration with stand-ins for the system fonts (Atkinson for Microsoft YaHei, Libertinus Serif for Yu Gothic) and asks fontique's fallback list for Han by default, Han in Japanese and Kana.
  • tests/test_gfx_world.py (reads game/crates/api/src/services/ui.rs) passes on both sides. cargo check -p api -p longshot-game -p modtool --all-targets builds; cargo fmt --check clean; cargo clippy -p game-ui -- -D warnings has nothing in the changed files.
  • The whole suite --strict on 5e6cb633c against main ca830e895: 843 passed, 42 failed, 13 skipped on both, the same 42 files (they fail on main in this WSL). The in-game runs were on d3be22ce1, the same two patches before the rebase onto ca830e895 (git range-diff: = for both; main changed none of these files).
  • A cold review by a second agent (the diff and the tests, the fontique and parley sources): its blocker, the system fonts in every text's family list, is fixed and tested; its other points (the Measurer's language, the bytes read twice) are in.

Still to test:

  • None for the fix. Seen alongside it, not changed here: the Korean menu's bold headings draw two syllables (업, 프) thinner, the UI's faux bold reading one contour winding for the whole glyph; its own PR follows.

Measurements

Nothing on the frame path: the fonts are read once, the first time a text needs a system font, and a language change lays the texts out again once. Memory: reading every CJK font found takes, on this PC's Windows 10, Microsoft YaHei 19.7 MB + JhengHei 21.4 MB + Yu Gothic 13.7 MB + Malgun Gothic 13.5 MB = 68.3 MB, where main read Yu Gothic alone (13.7 MB); once for the process (the UI thread and the main thread's measurer share the bytes). Mapping the files instead would need unsafe code, which the workspace denies: a follow-up if the team wants it.

Risks

On Windows, a CJK letter takes another font than before (a Japanese menu's: the same, Yu Gothic), and 54 MB more memory once any text needs a system font (the language rows 日本語 / 한국어 / 简体中文 are enough). Every text now has the menu's language as its locale: fonts with localized forms (locl) may draw a letter in that language's form. Nothing changes in saves or settings; a revert is enough.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named).
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here.
  • A check under tests/ that reads changed source is updated, not weakened (tests/test_gfx_world.py reads game/crates/api/src/services/ui.rs: it passes unchanged).
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths.
  • Screenshots of the same spot on main and here, for a change that shows on screen.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VxeaZksJ2byiSpsd2k2YbY

## Summary On Windows, the Insert menu in Simplified Chinese shows many letters as boxes ("画□□□", "□高比", "□出分辨率"), and in Korean every Hangul letter would be one. On `main`: set Game language to 简体中文 (Menu language Auto), press Insert, Graphics. The UI (`game/crates/ui/src/text.rs`) read one system font for all of Han, Kana, Hangul and Bopomofo: the first file of its list found, which on Windows is always Yu Gothic (Japanese). Yu Gothic lacks many Simplified Chinese letters and every Hangul one, and Microsoft YaHei and Malgun Gothic after it in the list were never read. This reads the first usable file for each CJK system font and gives each script and language its own first: - Hangul: Malgun Gothic. Kana: Yu Gothic. Bopomofo: Microsoft JhengHei. - Han by the text's language, the menu's: Simplified Chinese and any non-CJK language (fontique's default for Han, zh-CN) Microsoft YaHei; Traditional Chinese Microsoft JhengHei; Japanese Yu Gothic; Korean Malgun Gothic. - The others after it, so a letter the first lacks is looked up in the next. - Linux: the first usable Noto Sans CJK / Source Han file for every script. The system's fonts are fontique's fallbacks only, no longer in the family list every text is given: that list is tried before any fallback, so a CJK font in it draws every language's Han and Kana (with the four fonts read, Microsoft YaHei would have drawn the Japanese menu). The texts get the menu's language as their locale: the UI thread sends `Msg::FontLanguage` when `menu_lang()` changes (`game/crates/longshot-game/src/ui.rs`), and the main thread's `Measurer` measures in it too (`game/crates/api/src/services/ui.rs`). A system font's bytes are read once for the process and shared by both. Read first: `game/crates/ui/src/text.rs` `CJK_FONTS`, `CJK_FALLBACKS`, `fallback_plan`, `fallbacks_from` / `register_fallback`, then `Fonts::set_language` and `props`. Fixes #3075 ## Testing **Tested:** Windows 10, RTX 4090, driver 617.42, 2560x1440, keyboard and mouse; Insert menu, Graphics tab, Game language set in the run's settings, Menu language Auto. - `main` (299ed5b70's text code, unchanged on `main` since; #3149's runtime), Simplified Chinese: many letters are boxes ("画□□□", "□高比", "□出分辨率", "□生成与延□"). - This PR (runtime `v3.2.0-293-gd3be22ce1`), Simplified Chinese: every letter drawn ("画质预设", "宽高比", "输出分辨率", "帧生成与延迟"); Korean: every Hangul letter drawn (Malgun Gothic); Japanese: kana and kanji drawn by Yu Gothic, as on `main`. No fault in any run's log. - Screenshots: in the comment below the first (`main` and this PR in Simplified Chinese, this PR in Korean and Japanese). Checks (Linux, WSL Ubuntu 22.04): - `cargo test -p game-ui --lib`: on the test commit 4f807ec2e `each_cjk_script_and_language_is_drawn_by_its_own_windows_font_first_the_others_after_it` fails (`Hangul: Malgun Gothic`: Yu Gothic is Hangul's one font) and `the_system_fonts_are_fallbacks_only_and_han_takes_its_language_s_first` fails (`the system's fonts are not in every text's family list`); on 5e6cb633c 176 passed, 0 failed. The second test runs the real registration with stand-ins for the system fonts (Atkinson for Microsoft YaHei, Libertinus Serif for Yu Gothic) and asks fontique's fallback list for Han by default, Han in Japanese and Kana. - `tests/test_gfx_world.py` (reads `game/crates/api/src/services/ui.rs`) passes on both sides. `cargo check -p api -p longshot-game -p modtool --all-targets` builds; `cargo fmt --check` clean; `cargo clippy -p game-ui -- -D warnings` has nothing in the changed files. - The whole suite `--strict` on 5e6cb633c against `main` ca830e895: 843 passed, 42 failed, 13 skipped on both, the same 42 files (they fail on `main` in this WSL). The in-game runs were on d3be22ce1, the same two patches before the rebase onto ca830e895 (`git range-diff`: `=` for both; `main` changed none of these files). - A cold review by a second agent (the diff and the tests, the fontique and parley sources): its blocker, the system fonts in every text's family list, is fixed and tested; its other points (the Measurer's language, the bytes read twice) are in. **Still to test:** - None for the fix. Seen alongside it, not changed here: the Korean menu's bold headings draw two syllables (업, 프) thinner, the UI's faux bold reading one contour winding for the whole glyph; its own PR follows. ## Measurements Nothing on the frame path: the fonts are read once, the first time a text needs a system font, and a language change lays the texts out again once. Memory: reading every CJK font found takes, on this PC's Windows 10, Microsoft YaHei 19.7 MB + JhengHei 21.4 MB + Yu Gothic 13.7 MB + Malgun Gothic 13.5 MB = 68.3 MB, where `main` read Yu Gothic alone (13.7 MB); once for the process (the UI thread and the main thread's measurer share the bytes). Mapping the files instead would need `unsafe` code, which the workspace denies: a follow-up if the team wants it. ## Risks On Windows, a CJK letter takes another font than before (a Japanese menu's: the same, Yu Gothic), and 54 MB more memory once any text needs a system font (the language rows 日本語 / 한국어 / 简体中文 are enough). Every text now has the menu's language as its locale: fonts with localized forms (`locl`) may draw a letter in that language's form. Nothing changes in saves or settings; a revert is enough. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [x] `mise run test` passes (any failure that also fails on `main` is named). - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A fix: a game-free test that fails on `main` and passes here. - [x] A check under `tests/` that reads changed source is updated, not weakened (`tests/test_gfx_world.py` reads `game/crates/api/src/services/ui.rs`: it passes unchanged). - [ ] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. - [x] Screenshots of the same spot on `main` and here, for a change that shows on screen. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01VxeaZksJ2byiSpsd2k2YbY
The system fonts' fallbacks are now planned by fallback_plan (which file serves which script, in which language),
read from it as before: each script's first file found. The new check fails on that: Windows' Japanese Yu Gothic is
the first and only font of Han, Kana and Hangul, in every language.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VxeaZksJ2byiSpsd2k2YbY
fix(ui): Chinese and Korean letters are drawn by their own Windows font, not Japanese Yu Gothic's boxes (#3075)
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
5e6cb633cf
The UI read one system font for every CJK script, the first found: on Windows Yu Gothic (Japanese), which lacks
many Simplified Chinese letters and every Hangul one, so the menu in Simplified Chinese showed boxes and Korean
would show nothing else. Every CJK font found is read now (Microsoft YaHei, JhengHei, Yu Gothic, Malgun Gothic, or
Linux's Noto Sans CJK), each script and language's own first: Hangul Malgun, Kana Yu Gothic, Han in the menu's
language (Simplified Chinese by default), the others after it for a letter the first lacks. The texts are in the
menu's language (Msg::Language from the UI thread, the style's locale), so Han takes its font.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VxeaZksJ2byiSpsd2k2YbY
Author
Contributor

Tested in game: Windows 10, RTX 4090, driver 617.42, 2560x1440; Insert menu, Graphics tab, Game language in the settings, Menu language Auto. main (299ed5b70's text code, unchanged since), Simplified Chinese: many letters are boxes. This PR (d3be22ce1, the same patches as this head): Simplified Chinese, Korean and Japanese all drawn, no boxes; Japanese by Yu Gothic as before; no fault in the logs.

Tested in game: Windows 10, RTX 4090, driver 617.42, 2560x1440; Insert menu, Graphics tab, Game language in the settings, Menu language Auto. main (299ed5b70's text code, unchanged since), Simplified Chinese: many letters are boxes. This PR (d3be22ce1, the same patches as this head): Simplified Chinese, Korean and Japanese all drawn, no boxes; Japanese by Yu Gothic as before; no fault in the logs.
Author
Contributor

Screenshots: Windows 10, RTX 4090, 2560x1440; Insert menu, Graphics tab, Game language set in the run's settings, Menu language Auto.

main (299ed5b70's text code), Simplified Chinese: the letters Yu Gothic lacks are boxes.

main, Simplified Chinese

This PR (d3be22ce1), Simplified Chinese: every letter drawn.

this PR, Simplified Chinese

This PR, Korean: every Hangul letter drawn (on main Hangul has no font). The thin 업 and 프 in the two orange headings are the faux-bold bug this PR does not change; its own PR follows.

this PR, Korean

This PR, Japanese: kana and kanji by Yu Gothic, as on main.

this PR, Japanese

Screenshots: Windows 10, RTX 4090, 2560x1440; Insert menu, Graphics tab, Game language set in the run's settings, Menu language Auto. `main` (299ed5b70's text code), Simplified Chinese: the letters Yu Gothic lacks are boxes. ![main, Simplified Chinese](https://git.magicbean.dev/attachments/646d132c-e9e8-4e2b-83a8-08b27ec50217) This PR (d3be22ce1), Simplified Chinese: every letter drawn. ![this PR, Simplified Chinese](https://git.magicbean.dev/attachments/8d21375e-e738-4be1-96bd-89901c02b158) This PR, Korean: every Hangul letter drawn (on `main` Hangul has no font). The thin 업 and 프 in the two orange headings are the faux-bold bug this PR does not change; its own PR follows. ![this PR, Korean](https://git.magicbean.dev/attachments/339adc04-ca5c-481b-b8d6-a5c415765338) This PR, Japanese: kana and kanji by Yu Gothic, as on `main`. ![this PR, Japanese](https://git.magicbean.dev/attachments/46dcbf91-41e3-46ae-bacd-4a8650f919b5)
cuecuemoar changed title from WIP: fix(ui): Chinese and Korean letters are drawn by their own Windows font, not Japanese Yu Gothic's boxes to fix(ui): Chinese and Korean letters are drawn by their own Windows font, not Japanese Yu Gothic's boxes 2026-12-04 04:27:13 +00:00
Owner
@review
BeanBot left a comment

Recommendation: Request changes. It conflicts with its base branch: bring it up to date (@​fix or @​rebase try first). (L3) The reported Windows runs show that the Chinese and Korean menu text is drawn, and the fix has a game-free regression test. The changed fallback registration also runs on Linux, where its rendering has not yet been checked in game.

The change selects CJK fallback fonts by script and menu language, fixing missing Chinese and Korean glyphs on the tested Windows system. It adds approximately 54 MB of retained font data on that system and changes fallback selection on Linux as well.

Blocking (1): must change before merging.

  1. L3: It conflicts with its base branch: bring it up to date (@​fix or @​rebase try first). (for the author)

Should fix (1): not blocking, but worth doing before merging.

  • L2 game/crates/ui/src/text.rs:131: The plan selects the first existing file before trying to read or register it, so an unreadable or invalid font prevents trying later paths in the same group. (more on the line) Do: Choose the first path that can be read and yields registered font families, continuing through the group's remaining paths on failure.

Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)

  • L1 game/crates/ui/src/text.rs:319: Check the changed fallback registration in a Linux game run. (more on the line) Do: On Linux, open the same menu in Simplified Chinese, Traditional Chinese, Japanese and Korean and check the text and language names for missing or incorrect glyphs.

@fix can do L2.

Checks: Still running: 11 checks.

More: does it help, other systems, switches, what was read

Does it help: Yes for the reported Windows bug: the author reports boxes on main and readable Simplified Chinese and Korean text with the change, with Japanese also checked. Linux behavior remains unverified in game.

Other systems: Font selection and text locale also change on Linux, including the Steam Deck; no Linux game run is reported. Arabic and Hebrew system fonts now enter the fallback lists rather than the common family list. The UI thread and main-thread measurer share font bytes through a mutex-protected cache.

Switches: None.

Reviewed: 5e6cb633cf against ca830e8959: Read the available repository rules, PR template, standards, diff, commit messages, font fallback implementation and tests, language sender and measurer changes, and relevant renderer and editor callers. The large core and API files were inspected around the changed paths rather than read in full. The linked screenshots were not accessible in the closed network; their reported results were considered. The sibling Tooling AGENTS.md and docs/review-checklist.md were not present.; nothing run (a code review).

Checked and fine:

  • Both commits record AI assistance.
  • The diff adds no game-derived files, generated files, dependencies, API version changes or switches.
  • The Windows report covers the original Simplified Chinese failure and Korean and Japanese text.
  • The shared font-byte cache is protected by a mutex.

Testing: No code or tests were run for this read-only review. The author reports game-free tests passing and Windows in-game checks; CI is still running.

Overlaps and merge order: Not checked; network access is closed.


Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

**Recommendation: Request changes.** It conflicts with its base branch: bring it up to date (`@​fix` or `@​rebase` try first). (L3) The reported Windows runs show that the Chinese and Korean menu text is drawn, and the fix has a game-free regression test. The changed fallback registration also runs on Linux, where its rendering has not yet been checked in game. The change selects CJK fallback fonts by script and menu language, fixing missing Chinese and Korean glyphs on the tested Windows system. It adds approximately 54 MB of retained font data on that system and changes fallback selection on Linux as well. **Blocking (1)**: must change before merging. 1. **L3**: It conflicts with its base branch: bring it up to date (`@​fix` or `@​rebase` try first). *(for the author)* **Should fix (1)**: not blocking, but worth doing before merging. - **L2** `game/crates/ui/src/text.rs:131`: The plan selects the first existing file before trying to read or register it, so an unreadable or invalid font prevents trying later paths in the same group. (more on the line) **Do:** Choose the first path that can be read and yields registered font families, continuing through the group's remaining paths on failure. **Testing before merging (1)** (runs on the systems it can change; it doesn't hold the recommendation) - **L1** `game/crates/ui/src/text.rs:319`: Check the changed fallback registration in a Linux game run. (more on the line) **Do:** On Linux, open the same menu in Simplified Chinese, Traditional Chinese, Japanese and Korean and check the text and language names for missing or incorrect glyphs. `@fix` can do L2. **Checks:** Still running: 11 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes for the reported Windows bug: the author reports boxes on main and readable Simplified Chinese and Korean text with the change, with Japanese also checked. Linux behavior remains unverified in game. **Other systems:** Font selection and text locale also change on Linux, including the Steam Deck; no Linux game run is reported. Arabic and Hebrew system fonts now enter the fallback lists rather than the common family list. The UI thread and main-thread measurer share font bytes through a mutex-protected cache. **Switches:** None. **Reviewed:** 5e6cb633cffc against ca830e895926: Read the available repository rules, PR template, standards, diff, commit messages, font fallback implementation and tests, language sender and measurer changes, and relevant renderer and editor callers. The large core and API files were inspected around the changed paths rather than read in full. The linked screenshots were not accessible in the closed network; their reported results were considered. The sibling Tooling AGENTS.md and docs/review-checklist.md were not present.; nothing run (a code review). **Checked and fine:** - Both commits record AI assistance. - The diff adds no game-derived files, generated files, dependencies, API version changes or switches. - The Windows report covers the original Simplified Chinese failure and Korean and Japanese text. - The shared font-byte cache is protected by a mutex. **Testing:** No code or tests were run for this read-only review. The author reports game-free tests passing and Windows in-game checks; CI is still running. **Overlaps and merge order:** Not checked; network access is closed. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
@ -83,0 +128,4 @@
fn fallback_plan(there: &dyn Fn(&str) -> bool) -> Vec<Fallback> {
let found: Vec<(Cjk, &'static str)> = CJK_FONTS
.iter()
.filter_map(|(lang, paths)| paths.iter().copied().find(|p| there(p)).map(|p| (*lang, p)))
Member

L2 (should fix): The plan selects the first existing file before trying to read or register it, so an unreadable or invalid font prevents trying later paths in the same group.

When: On Linux, if the first Noto path exists but cannot be read and a later Source Han path is usable, the plan includes only the Noto path. Registration then produces no CJK fallback, whereas the previous loop continued to the next path after a failed read or registration.

Do: Choose the first path that can be read and yields registered font families, continuing through the group's remaining paths on failure.

**L2** (should fix): The plan selects the first existing file before trying to read or register it, so an unreadable or invalid font prevents trying later paths in the same group. *When:* On Linux, if the first Noto path exists but cannot be read and a later Source Han path is usable, the plan includes only the Noto path. Registration then produces no CJK fallback, whereas the previous loop continued to the next path after a failed read or registration. **Do:** Choose the first path that can be read and yields registered font families, continuing through the group's remaining paths on failure.
@ -229,1 +317,3 @@
}
let there = |p: &str| expand(p).is_some_and(|p| std::path::Path::new(&p).is_file());
self.fallbacks_from(&there, &system_file);
}
Member

L1 (should fix): Check the changed fallback registration in a Linux game run.

When: Linux now registers its CJK font only as script fallbacks and applies the menu locale, while the reported game runs cover Windows alone. A Linux font collection or locale selection can therefore produce different glyphs or missing text without being covered by those runs.

Do: On Linux, open the same menu in Simplified Chinese, Traditional Chinese, Japanese and Korean and check the text and language names for missing or incorrect glyphs.

**L1** (should fix): Check the changed fallback registration in a Linux game run. *When:* Linux now registers its CJK font only as script fallbacks and applies the menu locale, while the reported game runs cover Windows alone. A Linux font collection or locale selection can therefore produce different glyphs or missing text without being covered by those runs. **Do:** On Linux, open the same menu in Simplified Chinese, Traditional Chinese, Japanese and Korean and check the text and language names for missing or incorrect glyphs.
Owner
@fix
BeanBot force-pushed fix/cjk-menu-fonts from 5e6cb633cf
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
to f8825d13fa
Some checks failed
PR description / Title and description (pull_request_target) Failing after 6s
CI / What the change needs (pull_request) Successful in 9s
CI / Third-party parts and guide screenshots (pull_request) Successful in 14s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Successful in 19s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Failing after 1m23s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Failing after 16m21s
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Successful in 15m53s
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Successful in 15m28s
CI / Website build and checks (pull_request) Failing after 40s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Failing after 15m49s
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Successful in 48m46s
2026-12-04 06:53:28 +00:00
Compare
BeanBot left a comment

Recommendation: Approve. The code is ready: only testing is left. The Windows runs show the missing Chinese and Korean letters drawn, but the changed Linux fallback registration still needs an in-game run. Recommend approval; not approved on the forge.

What @fix changed
I changed this pull request: the new head is f8825d13fa. I rebased it onto main (095c4c0461).

Conflicts resolved

  • game/crates/longshot-game/src/ui.rs: Kept both language updates and renamed the pull request’s message to FontLanguage.
  • game/crates/ui/src/core.rs: Kept the base branch’s Language message and renamed the pull request’s colliding variant and handler to FontLanguage.
  • Also changed, beyond the conflict: game/crates/ui/src/core.rs I edited its description to match the change.

Changed

  • System font fallback selection in game/crates/ui/src/text.rs:126: Candidates are read and registered before selection, with later paths tried after read or registration failures. Added a regression test; it was not run as instructed.

Nothing was built or run: the checks run again on the new head.

The change selects system font fallbacks by script and menu language and shares font bytes between the UI and measurer. It fixes the reported Windows rendering issue at a reported cost of about 54 MB of additional memory on the tested PC.

Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)

  • L1 game/crates/ui/src/text.rs:319: Check the changed fallback registration in a Linux game run. When: Linux now registers its CJK font only as script fallbacks and applies the menu locale, while the reported game runs cover Windows alone. A Linux font collection or locale selection can therefore produce different glyphs or missing text without being covered by those runs. Do: On Linux, open the same menu in Simplified Chinese, Traditional Chinese, Japanese and Korean and check the text and language names for missing or incorrect glyphs.

Checks: they run again on this head; a failure shows on the pull request.

Also noticed (2; not asked for, not blocking)
  • The supplied base diff includes many changes beyond the four files listed in the pull request.
  • The fix tries later system font paths after read or registration failures and retains the language-specific fallback plan.
More: does it help, other systems, switches, what was read

Does it help: Yes for the reported Windows cases: the author reports boxes on main and correctly drawn Simplified Chinese and Korean text with the change. Linux rendering remains unverified in a game run.

Other systems: The fallback change also affects Linux and other scripts that use system fonts; no Linux game run is reported. The recorded Windows run covers Simplified Chinese, Korean and Japanese on one system.

Switches: None.

Reviewed: f8825d13fa against 095c4c0461: Read AGENTS.md, CONTRIBUTING.md, the font selection and registration code, the fix diff, and the focused UI diffs. The full base diff was truncated and includes many files beyond the four described; the changed code files were not all read in full.; nothing run (a code review).

Checked and fine:

  • The fix keeps the CJK font selection and language-specific fallback ordering.
  • The recorded Windows runs cover the reported missing-glyph cases.

Testing: No code or tests were run during this review. The author reports Windows game runs and Linux-hosted checks; CI has not run on the fix head.

Overlaps and merge order: Not checked.


Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The code is ready: only testing is left. The Windows runs show the missing Chinese and Korean letters drawn, but the changed Linux fallback registration still needs an in-game run. Recommend approval; not approved on the forge. **What `@fix` changed** I changed this pull request: the new head is f8825d13fa30. I rebased it onto `main` (095c4c0461b5). **Conflicts resolved** - game/crates/longshot-game/src/ui.rs: Kept both language updates and renamed the pull request’s message to FontLanguage. - game/crates/ui/src/core.rs: Kept the base branch’s Language message and renamed the pull request’s colliding variant and handler to FontLanguage. - Also changed, beyond the conflict: `game/crates/ui/src/core.rs` I edited its description to match the change. **Changed** - **System font fallback selection in game/crates/ui/src/text.rs:126**: Candidates are read and registered before selection, with later paths tried after read or registration failures. Added a regression test; it was not run as instructed. Nothing was built or run: the checks run again on the new head. The change selects system font fallbacks by script and menu language and shares font bytes between the UI and measurer. It fixes the reported Windows rendering issue at a reported cost of about 54 MB of additional memory on the tested PC. **Testing before merging (1)** (runs on the systems it can change; it doesn't hold the recommendation) - **L1** `game/crates/ui/src/text.rs:319`: Check the changed fallback registration in a Linux game run. *When:* Linux now registers its CJK font only as script fallbacks and applies the menu locale, while the reported game runs cover Windows alone. A Linux font collection or locale selection can therefore produce different glyphs or missing text without being covered by those runs. **Do:** On Linux, open the same menu in Simplified Chinese, Traditional Chinese, Japanese and Korean and check the text and language names for missing or incorrect glyphs. **Checks:** they run again on this head; a failure shows on the pull request. <details> <summary>Also noticed (2; not asked for, not blocking)</summary> - The supplied base diff includes many changes beyond the four files listed in the pull request. - The fix tries later system font paths after read or registration failures and retains the language-specific fallback plan. </details> <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes for the reported Windows cases: the author reports boxes on main and correctly drawn Simplified Chinese and Korean text with the change. Linux rendering remains unverified in a game run. **Other systems:** The fallback change also affects Linux and other scripts that use system fonts; no Linux game run is reported. The recorded Windows run covers Simplified Chinese, Korean and Japanese on one system. **Switches:** None. **Reviewed:** f8825d13fa30 against 095c4c0461b5: Read AGENTS.md, CONTRIBUTING.md, the font selection and registration code, the fix diff, and the focused UI diffs. The full base diff was truncated and includes many files beyond the four described; the changed code files were not all read in full.; nothing run (a code review). **Checked and fine:** - The fix keeps the CJK font selection and language-specific fallback ordering. - The recorded Windows runs cover the reported missing-glyph cases. **Testing:** No code or tests were run during this review. The author reports Windows game runs and Linux-hosted checks; CI has not run on the fix head. **Overlaps and merge order:** Not checked. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.</sub>
First-time contributor

LGTM

LGTM
First-time contributor

Additional Windows verification for #3075, covering the shader preparation screen.

On nightly-1022-b4d56f52 with Simplified Chinese selected, 备 (U+5907), 过 (U+8FC7), 仅 (U+4EC5), 进 (U+8FDB), and 闭 (U+95ED) appeared as boxes. I checked the installed font collections on the affected PC. YuGothM.ttc lacks all five glyphs, and msyh.ttc covers them. Nightly 1077 still used the first usable CJK font as its only CJK system fallback.

For an independent check on nightly-1077-f577a1ae, I rebuilt only the Vulkan renderer with a small Windows zh-Hans workaround. In gpu/vk/vk_ui.cpp, tell_fonts() reads the installed msyh.ttc and registers it through host->ui_font. The resulting build passed verification for all 54 files in its manifest. An in-game smoke test logged Microsoft YaHei registration, loaded a copied save, evaluated a scene frame with DLSS 5, and exited cleanly.

These results are from the local Nightly 1077 workaround. This PR addresses the same fallback selection in the shared UI code.

Additional Windows verification for #3075, covering the shader preparation screen. On `nightly-1022-b4d56f52` with Simplified Chinese selected, 备 (U+5907), 过 (U+8FC7), 仅 (U+4EC5), 进 (U+8FDB), and 闭 (U+95ED) appeared as boxes. I checked the installed font collections on the affected PC. `YuGothM.ttc` lacks all five glyphs, and `msyh.ttc` covers them. Nightly 1077 still used the first usable CJK font as its only CJK system fallback. For an independent check on `nightly-1077-f577a1ae`, I rebuilt only the Vulkan renderer with a small Windows `zh-Hans` workaround. In `gpu/vk/vk_ui.cpp`, `tell_fonts()` reads the installed `msyh.ttc` and registers it through `host->ui_font`. The resulting build passed verification for all 54 files in its manifest. An in-game smoke test logged Microsoft YaHei registration, loaded a copied save, evaluated a scene frame with DLSS 5, and exited cleanly. These results are from the local Nightly 1077 workaround. This PR addresses the same fallback selection in the shared UI code.
HumanBean deleted branch fix/cjk-menu-fonts 2026-12-04 17:02:05 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
5 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!3152
No description provided.