fix(ui): game-ui's tests build again, and one message carries the menu's language (#3152) #3187
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
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
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!3187
Loading…
Reference in a new issue
No description provided.
Delete branch "cuecuemoar/Longshot:fix/cjk-fonts-followup"
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?
Summary
#3152 was merged at the review bot's fix commit (
f8825d1), which had not been built, and two things came with it:cargo test -p game-uino longer compiles onmain(error[E0282]: type annotations needed,game/crates/ui/src/text.rs). The fix changedfallback_planto takeimpl FnMut(&'static str) -> bool, and two tests still passed&|p| .... They pass their closures by value now.fallbacks_from's doc comment is reworded in the file's style; the code is unchanged.Msg::Language(the theme's text sizes) while #3152 was in review, and the rebase kept #3152's asMsg::FontLanguage(the texts' locale, which font draws a Han letter first), each with its own field inPresents. Both hold the renderer'si18n::lang_code(): the start-up view'smenu_langand the status's are filled from it (gpu/vk/vk_menu.cpp).Msg::Languagenow also sets the fonts' language and lays every text out again when it changed, asFontLanguagedid;FontLanguageand its field are gone.Read first:
game/crates/ui/src/core.rs(Msg::Language's handler),game/crates/longshot-game/src/ui.rs(game_ui_present).See #3152, #3075.
Testing
Tested: Windows 10, RTX 4090, driver 617.42, 2560x1440, by hand; runtime
v3.2.0-309-g73a31480b(game/crates/ui,longshot-game/src/ui.rsandapi/src/services/ui.rsidentical to this head's), Insert menu, Graphics tab, Game language set in the run's settings, Menu language Auto: Simplified Chinese, Korean and Japanese each drawn in full, no boxes, as with #3152. No fault in any of the three runs' logs.Checks (Linux, WSL Ubuntu 22.04), on
cfd1c1781againstmain9f76a4379(this head92f01007dis the same two changes plus the test below, rebased ontoedeb8e2b5, whose new commits touch only the builder):cargo test -q -p game-ui:maindoes not compile (E0282); on92f01007d188 passed, 0 failed (with #3152'sfallback_tries_later_files_after_read_and_registration_failures).another_menu_language_lays_every_text_out_again_in_its_fonts_once(game/crates/ui/src/core/tests.rs):Msg::Languageto the UI core drops the laid-out texts, lays the mod's roots out and paints them again once, and the same language again does nothing. Nothing tested that path before: with the handler's font part taken out, it fails (the texts laid out in the other language are dropped).scripts/check_host_compile.py, Linux and Windows (llvm-mingw): both pass on both sides.cargo fmt --checkclean;cargo clippy -p game-ui -p longshot-game -p api --all-targetshas nothing in the changed files (on92f01007dtoo).--strict: here 844 passed, 46 failed, 13 skipped;mainfails the same 46 files (they fail onmainin this WSL).main's side stopped before its totals line, after its last three one-at-a-time checks (test_recorder_sync,test_prepare_stall,test_sampler_admission, none reading the UI).Still to test:
Measurements
Nothing to measure: a test's call and one message folded into another, sent at the same changes as before.
Risks
The fonts' language now arrives with
Msg::Language, sent only when the renderer's start-up view gives a code (as the theme's was);FontLanguagewas sent withenwhen the renderer gave none. With no code the texts keep no locale, and Han is drawn by fontique's default (Simplified Chinese's font first). Nothing changes in saves or settings; a revert is enough.Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named).main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here (game-ui's tests: they do not build onmain, they pass here).Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.🤖 Generated with Claude Code
https://claude.ai/code/session_01VxeaZmaAApz6unGJRcGT4M
Tested in game: Windows 10, RTX 4090, driver 617.42, 2560x1440, by hand: runtime v3.2.0-309-g73a31480b (the changed UI files identical to this head), Insert menu, Graphics tab, Menu language Auto: Simplified Chinese, Korean and Japanese each drawn in full, no boxes; no fault in the three runs' logs.
cfd1c1781392f01007dcPushed
92f01007d: a cold review found nothing blocking but no test of Msg::Language reaching the fonts; added another_menu_language_lays_every_text_out_again_in_its_fonts_once (fails with the handler's font part removed), dropped a needless closure annotation, rebased ontoedeb8e2b5(its new commits touch only the builder). game-ui 188/188, fmt and clippy clean. The in-game run stands: the game-run code is unchanged.WIP: fix(ui): game-ui's tests build again, and one message carries the menu's language (#3152)to fix(ui): game-ui's tests build again, and one message carries the menu's language (#3152)@Beanstalk On Linux (any GPU, the Steam Deck welcome), this PR's head against main: with the Game language set to Simplified Chinese, then Traditional Chinese, Japanese and Korean (Menu language Auto), open the Insert menu on its Graphics tab and take a screenshot of each. Expecting every letter drawn, no boxes, the same as or better than main (main's game-ui code is #3152's, so the two should look alike), and no fault in the log. This checks the system CJK fonts are found and used as fallbacks on Linux (Noto Sans CJK / Source Han), which only Windows has run so far.
@cuecuemoar only members of
BigBeanscan start the farm. One of them can approve this request by reacting 👍 to it or to this comment.