Skip to content

Fixed hud text width counting the shadow offset twice - #6635

Open
dekrom wants to merge 1 commit into
MeteorDevelopment:masterfrom
dekrom:fix/hud-text-width-shadow
Open

Fixed hud text width counting the shadow offset twice#6635
dekrom wants to merge 1 commit into
MeteorDevelopment:masterfrom
dekrom:fix/hud-text-width-shadow

Conversation

@dekrom

@dekrom dekrom commented Aug 30, 2026

Copy link
Copy Markdown

Type of change

  • Bug fix
  • New feature

Description

HudRenderer#textWidth adds the shadow twice:

return (width + (shadow ? 1 : 0)) * (scale == -1 ? hud.getTextScale() : scale) + (shadow ? 1 : 0);

once inside the multiply and once after it. text() draws the shadow at x + 1, an offset in
the same space as x, so the shadow only ever adds one unscaled pixel to the drawn width. The
reported width is scale px too wide, which shows up as extra padding on the right of every
shadowed hud element and grows with the text scale.

Related issues

None that I found.

How Has This Been Tested?

Not measured in game yet. text() offsets the shadow by one unscaled pixel, so the extra
* scale term in textWidth has nothing behind it. Builds clean against current master.

Checklist:

  • My code follows the style guidelines of this project.
  • I have added comments to my code in more complex areas.
  • I have tested the code in both development and production environments.

@Frko5000

Copy link
Copy Markdown
Contributor

12 open prs

@Frko5000

Copy link
Copy Markdown
Contributor

appreciate it tho

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.

2 participants