fix(issue-144): clean re-apply of macOS Cyrillic text fix#153
Open
fbraz3 wants to merge 10 commits into
Open
Conversation
(cherry picked from commit 3a28555)
Add GX-ISSUE144 instrumentation using sprintf + fprintf(stderr, ...) across font resolution, language loading, drawable caption paths, and control bar tooltip/cost rendering. Include a 2026-05-26 DEV_BLOG entry describing the diagnostics scope. (cherry picked from commit 9df81a3)
…descriptors (Issue #144) When russifier mod (00RussianZH.big) loads an incomplete Language.ini with UnicodeFontName=\"Arial\", it permanently overrides the stock \"Arial Unicode MS\" which supports Cyrillic. Since Arial lacks Cyrillic, construction captions render blank on macOS. Now when registryLanguage != \"English\", load stock English/Language with INI_LOAD_MULTIFILE mode to fill missing keys. This restores UnicodeFontName to \"Arial Unicode MS\" while preserving legitimate russifier overrides. Mirrors existing CSF fallback pattern (commit 3a28555). Fixes #144 Affects GeneralsXZH only (Language.ini path pattern) - GlobalLanguage::init() now loads stock Language.ini as fallback - Updated stderr diagnostics to show primary + fallback resolution - Expected fix: construction captions \"Строительство: XX%\" now render (cherry picked from commit 38f0e49)
vswprintf on macOS returns -1 when the wide-char format string contains any non-ASCII code point under the default C locale. This silently truncated every UnicodeString::format() call whose template included Cyrillic, producing an empty buffer and a width=0 caption. Root cause confirmed via stderr instrumentation showing 'vswprintf FAILED result=-1 fmt=Строительство: %.0f%%'. Fix wraps vswprintf in uselocale(newlocale(LC_CTYPE_MASK, UTF-8)) for the duration of the call, then restores the previous thread locale. Static locale_t, no per-call allocation. Validation: - Russian test: 'Строительство: 57%' renders in 3D caption. - English test: construction text unaffected. - Tooltip path unaffected (2D UnicodeString::format used here too). Also includes Cyrillic font pipeline and tooltip work from this session, plus diagnostic logs the user wants to keep until reporter validation is fully complete. Fixes #144 (cherry picked from commit 70fcb1f)
xlocale.h is macOS-only; on Linux it does not exist. uselocale and newlocale are exposed via <locale.h> when _GNU_SOURCE is defined. The previous Cyrillic vswprintf fix broke the Linux Flatpak CI build with: fatal error: xlocale.h: No such file or directory Guard the macOS-only include behind __APPLE__ and define _GNU_SOURCE on other POSIX systems so the locale_t APIs remain visible. (cherry picked from commit 135b1b6)
The 2026-05-27 fallback chain forced a reload of Data\\English\\Language.ini whenever the primary language was not English. This regressed in two ways: 1. Deploys without English (e.g. brazilian-only test data) caused INI::loadFileDirectory to throw INI_CANT_OPEN_FILE because it cannot find any file in the fallback directory. 2. When the primary language already set UnicodeFontName, the fallback ran with INI_LOAD_MULTIFILE semantics (overwrite) and clobbered the primary value with English's value, which is wrong for any official localization that has its own font descriptor. Gate the fallback on m_unicodeFontName.isEmpty() so it only activates for the russifier case (mod overrides the field with a Cyrillic-unfriendly font and leaves it broken). Also probe the file with doesFileExist first so a missing English file in the deploy is a no-op rather than a fatal throw. Fixes the macOS replay CI which is now run against a brazilian deploy. (cherry picked from commit ab2268e)
(cherry picked from commit 0bc3a40)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Clean re-application of the Issue #144 macOS Cyrillic text fix, started from a fresh
main(a7279e6) and cherry-picking only the font/caption related commits. The previous branchfix/issue-144-macos-cyrillic-texthad accumulated upstream sync, CI work, diagnostic instrumentation, and a criticalDrawable::calcPhysicsXformWheelsregression (broken roll clamp(unclampedRoll > 0.5f && unclampedRoll < -0.5f)+ autolevel branch + wheel consolidation) that broke the macOS replay-CI CRC at frames 1700/6900.Approach
main(a7279e682).6b1c77e72 fix(localization): harden drawable caption fallback, manually extracted the safe font/caption work and dropped the physics changes fromDrawable::calcPhysicsXformWheels(autolevel branch, broken roll clamp, wheel offset consolidation, commented-out roll-height block, cosmetic edits indrawEnthusiastic/drawBombed). Verified the resulting diff has zero matches form_totalRoll|unclampedRoll|Autolevel|m_pitchRate|m_rollRate|m_wheelInfo|REAL_TO_INT|rasing up|calcPhysics..github/folder as-is, then applied the 3echo "$OUTPUT"changes from0bc3a40d0 feat(ci): show full debug(replaces filteredgrepwith full output for replay debugging).e38c00a2f perf(headless): skip drawable caption + alternate-unicode chain(locally verified: does not fix CRC, not the actual root cause).15e669dcf fix(macos-fontconfig): prefer system Arial fallback(deploy-script only, not on the user's list).5b8b43697(blog) and4e9387ae7(branch analysis report) — both refer to the old branch structure.Commits
4d7e6e841fix(fonts): add unicode fallback for cyrillic292bb8c51fix(localization): add csf label fallbackf28e9ef19fix(localization): harden drawable caption fallback (cleaned: physics hunks removed)00f0d56a7fix(issue-144): add stderr diagnostics traces45dd89b21fix(language-ini): implement fallback chain to restore Cyrillic font descriptors (Issue macOS: Cyrillic text labels not rendered (numbers work, English labels work) #144)6f4534f7afix(fonts): break circular unicode fallback68f79fd26fix(unicode-format): allow Cyrillic in vswprintf on macOS7f6cb7558fix(unicode-format): make locale.h include portable for Linux62b25e736fix(language): only fall back to English when UnicodeFontName is missing2e74fee81feat(ci): show full debugDiff size
Local validation
macos_2p_vanilla_map.rep— exit 0 (was CRC mismatch at frame 6900)macos_6p_custom_map.rep— exit 0 (was CRC mismatch at frame 1700)macos_2p_custom_map.rep— exit 0 (was already passing)What was confirmed
vswprintfuselocale(newlocale(LC_CTYPE_MASK, "UTF-8", 0))wrap is the root cause fix for the 3D construction captionСтроительство: 57%not rendering on macOS.LoadUnicodeFallbackFont+ circular fallback break) ensures the localizedArialresolves to a Unicode-capable font on macOS.Drawable::calcPhysicsXformWheelschange in6b1c77e72was the regression source for the replay CI CRC mismatch and has been removed.Why not just fix the old branch?
The old branch had grown to 86 changed code files and 2,338 / 1,853 line changes, much of it upstream sync from thesuperhackers, CI infrastructure, and diagnostic instrumentation. A clean re-apply is simpler to review and bisect than surgical fixes on the old branch.
Related
fix/issue-144-macos-cyrillic-textbranch