Settings menu: a LANGUAGE line, Chinese drawn with the host's font #2445

Closed
github-bot wants to merge 1 commit from github-bot/gh-2445 into main AGit
Owner

@⁠suluojin-ui on GitHub · 2026-11-29 13:06 UTC · original
suluojin-ui:menu-zh → main · +673 −21 · 5 files · 1 commits · closed without merging

A Chinese menu for the F1 settings box, without growing the glyph table.

What it adds

  • LANGUAGE at the end of the settings list (VICTORY_MENU_LANG=zh|en). Unset means Chinese (the fork's audience); the choice is saved in victory-settings.txt like every other item and applied at once.
  • crates/victory-gpu/src/host/gdi_text.rs: paints the box with a face the host already has — Microsoft YaHei UI, then Microsoft YaHei, then SimHei — through GDI. Chinese, its punctuation and characters the 16x16 table has no picture for all show; letters are antialiased and as tall as the box's cells. Mixing is done for B8G8R8A8, R10G10B10A2 and R16G16B16A16_FLOAT.
  • crates/victory-gpu/src/host/menu_zh.rs: the menu's sentences in Chinese — setting names, values, actions, about lines, notes, the key-binding page. A line it does not list stays English.
  • SCALE_HEIGHT = 450 (was the hard-coded 540): the box and its letters are one step larger on 1440p (25-pixel letters, 1104x791 box). Trivial to drop back if you prefer the old size.

Why a host face

The table stays as it is: it is still the fallback. Nothing in font.rs or cjk_table.rs changes. A host face covers any Chinese without adding tens of thousands of glyphs, and the table's letters are drawn per pixel anyway, so one path does not exclude the other. VICTORY_MENU_TEXT=0 forces the table; an unknown frame format, an empty font list or a failing TextOutW falls back to it per frame.

What does not change

Only the drawing of the box and the wording. Saving, key bindings, save import/export, restarts and the frame-rate line's own path are untouched; the item is appended at the end of ITEMS, so no existing line moves.

Testing

cargo test -p victory-gpu --release host::menu — 15 tests, including a new the_text_layer_paints_the_box that paints a 368x269 and a 736x538 box through GDI and asserts letters appear and grow with the scale. Run on Windows 11 with an RTX 3070 Ti; also run in the real game (F1 opens, the list scrolls, a change saves at once).

Limits

  • GDI is Windows-only, as this host already is. Under Wine the faces may be missing, in which case the table takes over.
  • The Chinese table covers the menu as of 829188e9; lines added later show in English until translated.
**@⁠suluojin-ui** on GitHub · 2026-11-29 13:06 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2445) `suluojin-ui:menu-zh` → `main` · +673 −21 · 5 files · 1 commits · closed without merging A Chinese menu for the F1 settings box, without growing the glyph table. ## What it adds - **LANGUAGE** at the end of the settings list (`VICTORY_MENU_LANG=zh|en`). Unset means Chinese (the fork's audience); the choice is saved in `victory-settings.txt` like every other item and applied at once. - `crates/victory-gpu/src/host/gdi_text.rs`: paints the box with a face the host already has — Microsoft YaHei UI, then Microsoft YaHei, then SimHei — through GDI. Chinese, its punctuation and characters the 16x16 table has no picture for all show; letters are antialiased and as tall as the box's cells. Mixing is done for `B8G8R8A8`, `R10G10B10A2` and `R16G16B16A16_FLOAT`. - `crates/victory-gpu/src/host/menu_zh.rs`: the menu's sentences in Chinese — setting names, values, actions, about lines, notes, the key-binding page. A line it does not list stays English. - `SCALE_HEIGHT = 450` (was the hard-coded 540): the box and its letters are one step larger on 1440p (25-pixel letters, 1104x791 box). Trivial to drop back if you prefer the old size. ## Why a host face The table stays as it is: it is still the fallback. Nothing in `font.rs` or `cjk_table.rs` changes. A host face covers any Chinese without adding tens of thousands of glyphs, and the table's letters are drawn per pixel anyway, so one path does not exclude the other. `VICTORY_MENU_TEXT=0` forces the table; an unknown frame format, an empty font list or a failing `TextOutW` falls back to it per frame. ## What does not change Only the drawing of the box and the wording. Saving, key bindings, save import/export, restarts and the frame-rate line's own path are untouched; the item is appended at the end of `ITEMS`, so no existing line moves. ## Testing `cargo test -p victory-gpu --release host::menu` — 15 tests, including a new `the_text_layer_paints_the_box` that paints a 368x269 and a 736x538 box through GDI and asserts letters appear and grow with the scale. Run on Windows 11 with an RTX 3070 Ti; also run in the real game (F1 opens, the list scrolls, a change saves at once). ## Limits - GDI is Windows-only, as this host already is. Under Wine the faces may be missing, in which case the table takes over. - The Chinese table covers the menu as of 829188e9; lines added later show in English until translated.
- New last item LANGUAGE (VICTORY_MENU_LANG=zh/en): unset kept as Chinese on a
  Chinese PC, remembered in victory-settings.txt, applied at once.
- Chinese no longer needs cjk_table's 16x16 glyphs: host/gdi_text.rs paints the
  box with Microsoft YaHei UI / Microsoft YaHei / SimHei through GDI, mixing
  B8G8R8A8, R10G10B10A2 and R16G16B16A16_FLOAT; any other format and an empty
  font list fall back to the table (VICTORY_MENU_TEXT=0 turns it off).
- host/menu_zh.rs: the menu's sentences in Chinese; a line it does not list
  stays in English.
- Labels padded by display width (Chinese counts two columns), letters scaled
  with the box's scale so they match the table's cells.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 13:11:49 +00:00
github-bot closed this pull request 2026-11-29 13:39:23 +00:00

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
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
github/trustno1-coder--VIctory-NVIDIA!2445
No description provided.