fix: correct CJK tooltip layout and center option titles

This commit is contained in:
DragonHD
2026-09-20 11:25:04 +08:00
parent ca5748821c
commit 253cc47bc5
6 changed files with 450 additions and 1 deletions
+48
View File
@@ -3,6 +3,54 @@
Working log for the *The I of the Dragon* localization / HD project.
Newest entries on top.
## 2026-09-20 — Center option titles and shorten tutorial exit prompt
- User confirmed the HUD tooltip fix in game.
- Original tutorial text was `\aOK - quit, Cancel - continue tutorial.`;
replaced the verbose literal Chinese translation with `\a退出教程?`.
- Audio, game, video and controls titles all used fixed left x=620 before
resolution scaling. Their panel/button center is reference x=640. At
1280px, the 24px Chinese controls title was consequently 20px left of the
Bind button center. Title-only draw wrappers now measure actual text width
and subtract half from the transformed x=640 anchor, after screen scaling.
- `test_cjk_titles.py` executes all four original title call sites with three
text widths plus 1280/1920 screen-width cases. Both title tests and all 14
tooltip/layout tests pass. Game source patcher and translated Strings.dat
are deployed locally; the user confirmed both fixes in game.
## 2026-09-20 — Fix Chinese HUD tooltip overlap
- Reproduced the reported world-map/minimap tooltip bug in the game's actual
x86 wrapped-text routine (`0x4ED380`) using Unicorn. It builds a one-byte
temporary string before measuring each character, so the existing DBCS
metrics hook measured isolated GB2312 bytes as width/height zero. This
miscentered Chinese lines and advanced the next line by only the 5px line
distance, overlapping the 12px Chinese artwork.
- Added pair-aware read, append, and fit caves to `tools/apply_cjk.py`.
GB2312 pairs now reach the measurer together, are appended/consumed together,
and become complete-character wrap checkpoints. Initialized empty-line
checkpoints correctly so mixed ASCII/CJK wraps retain the prior line height.
A glyph wider than the available box is emitted intact rather than losing
its lead byte; existing caller clipping remains responsible for box bounds.
- Added `tools/test_cjk_layout.py`: executes the real layout/measurement
instructions and captures only the Direct3D draw boundary. Fourteen tests
cover screenshot tooltip strings, shortcuts, centering, control codes,
measure-only height, mixed text, whitespace, narrow boxes, and oversize glyphs.
The original overlap case changes from `(Chinese x=24,y=0; S x=20,y=5)` to
`(Chinese x=12,y=0; S x=20,y=17)` in a 48px box.
- No atlas, translation, font-size, or mission-script changes are needed.
Original exe and patcher snapshots: `backup_game/font-layout-20260920/`.
Local deployed program: `F:\steam\steamapps\common\The I of the Dragon\TheIOfTheDragon.exe`.
Validation (requires `unicorn`):
`python tools/test_cjk_layout.py --exe build/cjk-layout-fixed.exe -v`
Progress audit: local HEAD matched Gitea `ca57488` before this fix; 1884 texture
entries / 1882 preprocessed PNGs, 1397 geometry entries, and 479/496 translated
Strings.dat IDs. Mission scripts, description tables, baked text, and HD
upscaling remain separate unfinished work. Other-font CJK coverage is also
still limited as documented in patch-notes.md.
## 2026-09-20 — Full `Strings.dat` translation
- Translated the `English` column for **479 / 496** entries (the rest are pure-format