fix(menu): the language rows draw Русский, 日本語, 한국어 and 中文 in any menu language, not ??? #1562

Merged
HumanBean merged 1 commit from HumanBean/Longshot:fix/menu-language-names into main 2026-11-18 07:15:33 +00:00
Owner

Type: fix · Risk: low · Tested on: not yet run in the game · Needs: Linux and Windows, any GPU

TL;DR

In an English menu, the Game language and Menu language settings showed Russian, Japanese, Korean and Chinese as ???, because the menu's font has no letters for those scripts. This PR loads a font with those letters the first time one of those names is on screen, so the names draw properly whatever language the menu is in. Nothing extra is loaded for a player who never opens those settings. It has not been run in the game yet.

Breakdown

  • Who it helps: anyone who opens Game language or Menu language with the menu in a Latin-script language (English, French, ...).
  • What was wrong: fonts for other scripts were loaded only for the menu's own language, so the language names in other scripts had no letters to draw.
  • What changes: when one of those rows shows a name whose letters the menu's fonts lack, that script's font is loaded on the next frame.
  • What does not change: the settings themselves, language.txt, the options file, and a menu that never shows those names.
  • How it was checked: reading the code only; no build, no test run and no game run yet.
  • What is still open: a run in the game on Linux and on Windows, screenshots, and the test suite.
  • Risk: low: the extra fonts load only when those names are shown; at worst a name still shows ? on a PC with none of the fonts.

Why

The two Language rows on the Gameplay tab show each language by its own name (Русский, 日本語, 한국어, 简体中文, 繁體中文). The menu draws with the game's Clarimo (Latin letters only) or the bundled Libertinus (no CJK), and it merges in fonts for other scripts only for the menu's own language. In an English menu, none are merged, so those names draw as ?.

How to reproduce

Seen on: Linux (any GPU)
Settings and switches: defaults, menu language English (or Auto with an English game)
Steps: open the Insert menu, go to Gameplay, cycle Game language (or Menu language) to Русский, 日本語, 한국어, 简体中文 or 繁體中文
Expected: the language's name
Actual: ???

What changed

A name a Language row shows with letters past Latin is recorded, and the next frame's ImGui setup merges in that language's fonts when the menu's fonts lack any of its letters, using the same font list as a menu in that language.

  • i18n: game_lang_name() and lang_name() in gpu/vk/vk_menu_i18n.cpp record a shown non-Latin name once; names_shown_since() hands out the new ones.
  • ui: name_fonts() in gpu/vk/vk_imgui.cpp, called from begin() next to script_fonts(), checks each new name's letters with ImFont::IsGlyphInFont and calls script_fonts() for that language when one is missing.
  • ui: script_fonts() loads a system font file once. On Linux the single Noto Sans CJK file serves Japanese, Korean and both Chinese scripts; it used to be read and held once per script (about 20 MB each).

Measurements

Verdict: nothing to measure for speed. Memory grows only when a non-Latin name is shown with its letters missing: by the size of that script's font file (on Linux one Noto CJK file for all four CJK names, now held once instead of once per script).

Flags and settings

None

Testing

Tested: nothing yet: the PR is opened untested at the request of the person I work for. No build, no game run, no test suite on this PC.

Not tested: everything: the build on Windows (llvm-mingw) and Linux, the rows in the game, a menu in Japanese, Korean or Chinese (the dedup of the system font changes which file serves a second CJK language there).

Must be tested:

  • Linux, any GPU: menu in English, Gameplay tab, cycle Game language and Menu language through Русский, 日本語, 한국어, 简体中文, 繁體中文, expecting each name drawn (at most one frame of ? the first time) and a vk: ui: the letters of ... line in the log for each script loaded (by hand)
  • Windows, any GPU: the same steps, expecting the same (by hand, or Test Farm: @Beanstalk windows, the Gameplay tab's language rows in an English menu)
  • Linux: menu set to 日本語, then to 简体中文 without restarting, expecting the menu fully drawn in both (by hand)

Risks

What could break: a name could still draw as ? on a PC with none of the listed system fonts and no game font for that script; a Chinese menu after a Japanese one on Linux now reuses the one Noto CJK file already loaded, rather than loading it again.

Turning it off: revert the commit.

Compatibility: Nothing changes.

Checklist

Everyone

  • One topic.
  • The title is a Conventional Commit (type(scope): description) of the status line's type.
  • Why gives the reason plainly and links the issues that fit (the tracker searched).
  • Tested on my own PC where it runs (in the game, for a change the game runs), as Testing's Tested says; what
    can't be run by hand is in Testing's Not testable by hand, with why. (not yet run in the game)
  • Measurements has a verdict, or one line saying why there is nothing to measure.
  • Nothing gets worse that I know of: any cost (speed, latency, memory, a setup that worked before) is measured and
    in Risks.
  • Testing names what was tested, what wasn't, and what must still be tested, where and how.
  • Rebased on current main.
  • python -I -B tests/run_all.py passes (any failure that also fails on main is named). (not run on this PC)
  • No game files, dumps, build output or generated files.
  • third_party/ untouched (a new folder with a PROVENANCE.md instead).
  • The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled.

When it applies

  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.
  • Screenshots of the same spot, captioned like the Measurements columns, for a change that shows on screen. (after the game run)
  • A game-free test added for the fix, failing on main and passing here. (none: the bug needs the real fonts loaded)
  • Host code builds on both Windows (llvm-mingw) and Linux, with UTF-8 paths. (not built yet)

🤖 Generated with Claude Code

**Type:** fix · **Risk:** low · **Tested on:** not yet run in the game · **Needs:** Linux and Windows, any GPU ## TL;DR In an English menu, the Game language and Menu language settings showed Russian, Japanese, Korean and Chinese as `???`, because the menu's font has no letters for those scripts. This PR loads a font with those letters the first time one of those names is on screen, so the names draw properly whatever language the menu is in. Nothing extra is loaded for a player who never opens those settings. It has not been run in the game yet. ## Breakdown - **Who it helps:** anyone who opens Game language or Menu language with the menu in a Latin-script language (English, French, ...). - **What was wrong:** fonts for other scripts were loaded only for the menu's own language, so the language names in other scripts had no letters to draw. - **What changes:** when one of those rows shows a name whose letters the menu's fonts lack, that script's font is loaded on the next frame. - **What does not change:** the settings themselves, language.txt, the options file, and a menu that never shows those names. - **How it was checked:** reading the code only; no build, no test run and no game run yet. - **What is still open:** a run in the game on Linux and on Windows, screenshots, and the test suite. - **Risk:** low: the extra fonts load only when those names are shown; at worst a name still shows `?` on a PC with none of the fonts. ## Why The two Language rows on the Gameplay tab show each language by its own name (Русский, 日本語, 한국어, 简体中文, 繁體中文). The menu draws with the game's Clarimo (Latin letters only) or the bundled Libertinus (no CJK), and it merges in fonts for other scripts only for the menu's own language. In an English menu, none are merged, so those names draw as `?`. ## How to reproduce **Seen on:** Linux (any GPU) **Settings and switches:** defaults, menu language English (or Auto with an English game) **Steps:** open the Insert menu, go to Gameplay, cycle Game language (or Menu language) to Русский, 日本語, 한국어, 简体中文 or 繁體中文 **Expected:** the language's name **Actual:** `???` ## What changed A name a Language row shows with letters past Latin is recorded, and the next frame's ImGui setup merges in that language's fonts when the menu's fonts lack any of its letters, using the same font list as a menu in that language. - i18n: `game_lang_name()` and `lang_name()` in `gpu/vk/vk_menu_i18n.cpp` record a shown non-Latin name once; `names_shown_since()` hands out the new ones. - ui: `name_fonts()` in `gpu/vk/vk_imgui.cpp`, called from `begin()` next to `script_fonts()`, checks each new name's letters with `ImFont::IsGlyphInFont` and calls `script_fonts()` for that language when one is missing. - ui: `script_fonts()` loads a system font file once. On Linux the single Noto Sans CJK file serves Japanese, Korean and both Chinese scripts; it used to be read and held once per script (about 20 MB each). ## Measurements **Verdict:** nothing to measure for speed. Memory grows only when a non-Latin name is shown with its letters missing: by the size of that script's font file (on Linux one Noto CJK file for all four CJK names, now held once instead of once per script). ### Flags and settings None ## Testing **Tested:** nothing yet: the PR is opened untested at the request of the person I work for. No build, no game run, no test suite on this PC. **Not tested:** everything: the build on Windows (llvm-mingw) and Linux, the rows in the game, a menu in Japanese, Korean or Chinese (the dedup of the system font changes which file serves a second CJK language there). **Must be tested:** - Linux, any GPU: menu in English, Gameplay tab, cycle Game language and Menu language through Русский, 日本語, 한국어, 简体中文, 繁體中文, expecting each name drawn (at most one frame of `?` the first time) and a `vk: ui: the letters of ...` line in the log for each script loaded (by hand) - Windows, any GPU: the same steps, expecting the same (by hand, or Test Farm: @Beanstalk windows, the Gameplay tab's language rows in an English menu) - Linux: menu set to 日本語, then to 简体中文 without restarting, expecting the menu fully drawn in both (by hand) ## Risks **What could break:** a name could still draw as `?` on a PC with none of the listed system fonts and no game font for that script; a Chinese menu after a Japanese one on Linux now reuses the one Noto CJK file already loaded, rather than loading it again. **Turning it off:** revert the commit. **Compatibility:** Nothing changes. ## Checklist ### Everyone - [x] One topic. - [x] The title is a Conventional Commit (`type(scope): description`) of the status line's type. - [x] Why gives the reason plainly and links the issues that fit (the tracker searched). - [ ] Tested on my own PC where it runs (in the game, for a change the game runs), as Testing's Tested says; what can't be run by hand is in Testing's Not testable by hand, with why. (not yet run in the game) - [x] Measurements has a verdict, or one line saying why there is nothing to measure. - [x] Nothing gets worse that I know of: any cost (speed, latency, memory, a setup that worked before) is measured and in Risks. - [x] Testing names what was tested, what wasn't, and what must still be tested, where and how. - [x] Rebased on current `main`. - [ ] `python -I -B tests/run_all.py` passes (any failure that also fails on `main` is named). (not run on this PC) - [x] No game files, dumps, build output or generated files. - [x] `third_party/` untouched (a new folder with a `PROVENANCE.md` instead). - [x] The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled. ### When it applies - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. - [ ] Screenshots of the same spot, captioned like the Measurements columns, for a change that shows on screen. (after the game run) - [ ] A game-free test added for the fix, failing on `main` and passing here. (none: the bug needs the real fonts loaded) - [ ] Host code builds on both Windows (llvm-mingw) and Linux, with UTF-8 paths. (not built yet) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fix(menu): the Game language and Menu language rows draw Русский, 日本語, 한국어 and 中文 in any menu language, not ???
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 7s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 10s
CI / Workflow lint (actionlint) (pull_request) Successful in 10s
Third-party parts / As their notes say (pull_request) Successful in 10s
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Failing after 4s
4365ac6ffa
The rows show each language by its own name, but the menu merged in a font of
other letters only for its own language: in an English menu, with the game's
Clarimo (Latin only) or Libertinus (no CJK), those names drew as ?.

A name a Language row shows with letters past Latin is recorded
(vk_menu_i18n.cpp names_shown_since); the next frame's begin merges in that
language's fonts when the menu's fonts lack a letter of it. Only names shown,
and only when missing, so an English menu that never opens the rows loads
nothing more. Linux's one Noto CJK file serving four scripts is now held once,
not once a script.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
HumanBean changed title from WIP: fix(menu): the language rows draw Русский, 日本語, 한국어 and 中文 in any menu language, not ??? to fix(menu): the language rows draw Русский, 日本語, 한국어 and 中文 in any menu language, not ??? 2026-11-18 07:15:28 +00:00
HumanBean deleted branch fix/menu-language-names 2026-11-18 07:15:33 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
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!1562
No description provided.