fix(menu): the language rows draw Русский, 日本語, 한국어 and 中文 in any menu language, not ??? #1562
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!1562
Loading…
Reference in a new issue
No description provided.
Delete branch "HumanBean/Longshot:fix/menu-language-names"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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
?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.
game_lang_name()andlang_name()ingpu/vk/vk_menu_i18n.cpprecord a shown non-Latin name once;names_shown_since()hands out the new ones.name_fonts()ingpu/vk/vk_imgui.cpp, called frombegin()next toscript_fonts(), checks each new name's letters withImFont::IsGlyphInFontand callsscript_fonts()for that language when one is missing.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:
?the first time) and avk: ui: the letters of ...line in the log for each script loaded (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
type(scope): description) of the status line's type.can't be run by hand is in Testing's Not testable by hand, with why. (not yet run in the game)
in Risks.
main.python -I -B tests/run_all.pypasses (any failure that also fails onmainis named). (not run on this PC)third_party/untouched (a new folder with aPROVENANCE.mdinstead).When it applies
Assisted-by:/Co-Authored-By:trailers.mainand passing here. (none: the bug needs the real fonts loaded)🤖 Generated with Claude Code
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 ???