[PR #5878] [MERGED] Recover bitmap font glyphs when the dynamic atlas region fills up #6533

Closed
opened 2026-11-03 06:22:33 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5878
Author: @Joansitoh
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: fix/5719-font-region-full


📝 Commits (1)

  • d6c1bf1 Recover bitmap font glyphs when the dynamic atlas region fills up

📊 Changes

2 files changed (+79 additions, -1 deletions)

View changed files

📝 crates/horizon-client-render/src/font.rs (+77 -1)
📝 crates/horizon-client/src/game.rs (+2 -0)

📄 Description

🤖 Opened by Joansitoh's AI agent (Claude Code, Sonnet 5.5), not by Joansitoh personally.

What

Custom bitmap fonts from a server resource pack stopped rendering after a few minutes. Sheets outside the minecraft namespace are copied on first use into a reserved atlas region (GLYPH_ROWS rows). When it filled, Font::glyph_of stored the missing glyph permanently, and the region was never freed.

  • Region gets a full flag, set when a glyph does not fit.
  • glyph_of returns the missing glyph for that call only when the region overflowed, without caching it. Characters with no provider are still cached as missing and never trigger a reset.
  • New Font::begin_frame(), called at the start of Game::render: if the region filled, it clears the glyph caches and cursor and bumps the epoch, so layout caches keyed on Font::epoch() invalidate. It waits for the frame boundary because quads already queued hold the old rects.

A single frame needing more glyphs than the region holds stays degraded for that frame but recovers on the next.

Vanilla reference

FontSet/GlyphStitcher grow their textures and never run out; this is the fixed-size-atlas equivalent.

Tests

New font::tests: overflow glyph is missing and not cached, epoch unchanged until begin_frame, then the glyph resolves with a real rect; a char with no provider does not reset. cargo test -p horizon-client-render --lib (excluding gfx::) passes: 665 passed. Harnesses run: chat_screen, container_title pass.

The full --quick run had one unrelated failure: a gfx:: test in horizon-client-render crashed with SIGSEGV (GPU test on this machine). Those tests don't touch fonts.

Remaining affected harnesses: run by CI's parity job.

pr_ready (tools/pr_ready.py --quick --base upstream/main)

Check Result
Scope ✅ 2 files, +79 −1
Python tests ✅ 515 passed
rustfmt ✅
clippy ✅
tests: horizon-client, horizon-client-render ❌ gfx test SIGSEGV (unrelated); non-gfx 665 passed
doc tests ✅
Parity ➖ 117 affected, to run in CI (--quick)

Fixes #5719

🤖 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/5878 **Author:** [@Joansitoh](https://github.com/Joansitoh) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/5719-font-region-full` --- ### 📝 Commits (1) - [`d6c1bf1`](https://github.com/horizon-rust/horizon/commit/d6c1bf17911fec16ef313a8fb1770b365a175f2b) Recover bitmap font glyphs when the dynamic atlas region fills up ### 📊 Changes **2 files changed** (+79 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/font.rs` (+77 -1) 📝 `crates/horizon-client/src/game.rs` (+2 -0) </details> ### 📄 Description > 🤖 Opened by Joansitoh's AI agent (Claude Code, Sonnet 5.5), not by Joansitoh personally. ## What Custom bitmap fonts from a server resource pack stopped rendering after a few minutes. Sheets outside the `minecraft` namespace are copied on first use into a reserved atlas region (`GLYPH_ROWS` rows). When it filled, `Font::glyph_of` stored the missing glyph permanently, and the region was never freed. - `Region` gets a `full` flag, set when a glyph does not fit. - `glyph_of` returns the missing glyph for that call only when the region overflowed, without caching it. Characters with no provider are still cached as missing and never trigger a reset. - New `Font::begin_frame()`, called at the start of `Game::render`: if the region filled, it clears the glyph caches and cursor and bumps the epoch, so layout caches keyed on `Font::epoch()` invalidate. It waits for the frame boundary because quads already queued hold the old rects. A single frame needing more glyphs than the region holds stays degraded for that frame but recovers on the next. ## Vanilla reference `FontSet`/`GlyphStitcher` grow their textures and never run out; this is the fixed-size-atlas equivalent. ## Tests New `font::tests`: overflow glyph is missing and not cached, epoch unchanged until `begin_frame`, then the glyph resolves with a real rect; a char with no provider does not reset. `cargo test -p horizon-client-render --lib` (excluding `gfx::`) passes: 665 passed. Harnesses run: `chat_screen`, `container_title` pass. The full `--quick` run had one unrelated failure: a `gfx::` test in horizon-client-render crashed with SIGSEGV (GPU test on this machine). Those tests don't touch fonts. Remaining affected harnesses: run by CI's parity job. **pr_ready** (`tools/pr_ready.py --quick --base upstream/main`) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +79 −1 | | Python tests | ✅ 515 passed | | rustfmt | ✅ | | clippy | ✅ | | tests: horizon-client, horizon-client-render | ❌ gfx test SIGSEGV (unrelated); non-gfx 665 passed | | doc tests | ✅ | | Parity | ➖ 117 affected, to run in CI (--quick) | Fixes #5719 🤖 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 06:22:33 +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#6533
No description provided.