[PR #2117] [MERGED] Font: menus keep their run-time glyphs when the renderer rebuilds its atlas #4020

Closed
opened 2026-11-03 04:14:05 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2117
Author: @ludovic111
Created: 10/26/2026
Status: ✅ Merged
Merged: 10/26/2026
Merged by: @ludovic111

Base: main ← Head: fix/font-glyphs-atlas-rebuild


📝 Commits (1)

  • 5ec21ff Font: menus keep their run-time glyphs when the renderer rebuilds its atlas

📊 Changes

2 files changed (+39 additions, -0 deletions)

View changed files

📝 crates/horizon-client/src/font.rs (+25 -0)
📝 crates/horizon-client/src/game.rs (+14 -0)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

Re-opened from #2066 by kohad1ck, whose account no longer exists; their commits are kept as is.

Fixes #1824, fixes #2040.

What and why

With Chinese or Japanese selected, menu labels went blank about two seconds after the title screen appeared. Glyphs the bitmap sheets don't cover (unifont) are rasterized at run time into a reserved area of the GUI atlas, and the font caches the rect it was given. When the loading screen hands over to the game, a new renderer is built, and its atlas texture is created from HudAtlas.pixels, which never holds a run-time glyph. The cache still pointed at rects in the previous texture, so every character drawn before the handoff went blank.

build_renderer and loading_renderer now call font.reset_cache() before the new texture exists, so the glyphs drawn again are placed into it. ui_theme already does this when its atlas changes (reset_atlas). This is Horizon's renderer lifetime, with no vanilla behaviour involved, and Latin text is unaffected.

How tested

  • Gate integration tree (main + this change + the night's other contributor PRs): cargo fmt --check, cargo clippy -p horizon-client --all-targets -D warnings, cargo test -p horizon-client --lib --bins --tests 1306 passed, including font::tests::a_rebuilt_atlas_gets_its_glyphs_again. The parity harnesses parity.py --changed-files picks for this tree also ran there.
  • Reviewed by rdbt on #2066 (approved).

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/2117 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/font-glyphs-atlas-rebuild` --- ### 📝 Commits (1) - [`5ec21ff`](https://github.com/horizon-rust/horizon/commit/5ec21ff5f1468b052d104bd84e5ae07b02a3afe8) Font: menus keep their run-time glyphs when the renderer rebuilds its atlas ### 📊 Changes **2 files changed** (+39 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/font.rs` (+25 -0) 📝 `crates/horizon-client/src/game.rs` (+14 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Re-opened from #2066 by kohad1ck, whose account no longer exists; their commits are kept as is. Fixes #1824, fixes #2040. ## What and why With Chinese or Japanese selected, menu labels went blank about two seconds after the title screen appeared. Glyphs the bitmap sheets don't cover (unifont) are rasterized at run time into a reserved area of the GUI atlas, and the font caches the rect it was given. When the loading screen hands over to the game, a new renderer is built, and its atlas texture is created from `HudAtlas.pixels`, which never holds a run-time glyph. The cache still pointed at rects in the previous texture, so every character drawn before the handoff went blank. `build_renderer` and `loading_renderer` now call `font.reset_cache()` before the new texture exists, so the glyphs drawn again are placed into it. `ui_theme` already does this when its atlas changes (`reset_atlas`). This is Horizon's renderer lifetime, with no vanilla behaviour involved, and Latin text is unaffected. ## How tested - Gate integration tree (main + this change + the night's other contributor PRs): `cargo fmt --check`, `cargo clippy -p horizon-client --all-targets -D warnings`, `cargo test -p horizon-client --lib --bins --tests` 1306 passed, including `font::tests::a_rebuilt_atlas_gets_its_glyphs_again`. The parity harnesses `parity.py --changed-files` picks for this tree also ran there. - Reviewed by rdbt on #2066 (approved). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:14:05 +07:00
Sign in to join this conversation.
No milestone
No project
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
horizon-rust/horizon#4020
No description provided.