Skip to content

2D text at physical resolution (crisp 4K HUD) + atlas-full warning#81

Closed
proggeramlug wants to merge 1 commit into
fix/round2-visual-correctnessfrom
feat/2d-text-physical-res
Closed

2D text at physical resolution (crisp 4K HUD) + atlas-full warning#81
proggeramlug wants to merge 1 commit into
fix/round2-visual-correctnessfrom
feat/2d-text-physical-res

Conversation

@proggeramlug

Copy link
Copy Markdown
Contributor

Stacked on #76 (it builds on the 2D gamma change in text_renderer.rs). Audit F5's remaining half.

The fix

Glyphs rasterized at logical size were stretched ×1.5 by the 2D projection at 150% display scaling — the whole HUD was a bilinear blur at 4K. Now:

  • draw_text_ex rasterizes at size × dpi (physical/logical surface ratio) and scales layout metrics back to logical — the projection's stretch lands bitmaps 1:1 on physical pixels.
  • measureText is untouched and stays exact: fontdue advances are strictly linear in pixel size, so logical measurement ≡ drawn advance.
  • The atlas now warns once when full instead of silently wrapping UVs into garbage glyphs (the audit's finding; physical-size cache entries raise atlas pressure, so naming the failure mode matters now — grow/evict is the follow-up).

Validated on the live game at 4K: correct layout/centering, native-res rasters, no warnings on the shooter's glyph set.

Round-2 audit F5: glyphs were rasterized at LOGICAL pixel size and the
2D projection stretched them x1.5 at 150% display scaling — every HUD
string was a bilinear-magnified blur at 4K.

- draw_text_ex rasterizes at size x dpi (dpi = physical surface width /
  logical width) and divides the layout metrics back to logical, so the
  projection's stretch lands the bitmap 1:1 on physical pixels.
- measureText stays in logical units and stays exact: fontdue advances
  are strictly linear in pixel size, so advance(phys)/dpi ==
  advance(logical) up to f32 rounding.
- The glyph atlas warns once when full instead of silently wrapping
  UVs into garbage glyphs (grow/evict is the durable follow-up; the
  physical-size cache entries raise pressure, so the warning matters
  now).

Validated on the live game at 4K: title + HUD render with correct
layout and native-res rasters; no atlas warnings on the shooter's
glyph set.
@coderabbitai

coderabbitai Bot commented Jul 4, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b2af9057-d289-4a73-bd3f-3ca2d030736c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/2d-text-physical-res

Comment @coderabbitai help to get the list of available commands.

@proggeramlug

Copy link
Copy Markdown
Contributor Author

Landed in main via the round-2 consolidation merge (#83). All commits from this branch are now on main; closing as merged-through-integration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant