Fixed hud text scale being ignored with the custom font disabled - #6663
Open
c8dhjp4tyv-bit wants to merge 1 commit into
Open
c8dhjp4tyv-bit wants to merge 1 commit into
c8dhjp4tyv-bit wants to merge 1 commit into
Conversation
c8dhjp4tyv-bit
force-pushed
the
fix/hud-text-scale-vanilla-font
branch
from
September 13, 2026 19:22
fafd932 to
cccd49e
Compare
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.
Type of change
Description
With Custom Font disabled, the hud's Text Scale setting (and any per-element scale passed to
HudRenderer#text) has no effect: every hud element keeps rendering at the default size while its background, spacing and click box grow, so the text ends up floating in an oversized box. See the screenshots in #6570.HudRenderer#textsets the vanilla renderer's scale for measuring but not for drawing:while
textWidth/textHeightright below it do apply it:So the element is laid out at the requested scale but drawn at whatever
HudRenderer#beginleft behind —VanillaTextRenderer.INSTANCE.begin(graphics), i.e. a fixed1 * 2.This was lost in the 26.1 update (#6266). Before it,
text()had theINSTANCE.scale = scale * 2;line, andbegin()setscaleIndividually = trueso that the old batched renderer applied the scale perrender()call instead of once for the whole batch. The rewrittenVanillaTextRendereralways scales per call throughgraphics.pose(), so restoring the assignment is all that is needed:scaleIndividuallyhas been dead since that rewrite — the only remaining reference resets it tofalse— but it is public and addons shadow it, so it is left alone here; removing it is a separate call for you to make.This does not touch the custom font path, and it does not affect text drawn outside the hud (modules use
TextRenderer#begin(graphics, scale), which sets the scale itself).Related issues
#6570 (the hud scaling case reported in this comment)
How Has This Been Tested?
./gradlew compileJavapasses.Isolating the arithmetic of both paths with vanilla font metrics (
Font#lineHeight9, 6px glyphs) shows the layout/draw mismatch and that it disappears with the fix —textWidth()/textHeight()are what the element lays itself out with,drawnis what actually ends up on screen:At the default scale of 1 nothing changes, which is why the bug only shows up once Text Scale is moved.
In-game with Custom Font off: changing Text Scale now resizes hud text as it does with the custom font enabled, and text fills its background again instead of sitting in an oversized box.
Checklist: