Skip to content

fix(font): 修复 betterFont下自定义计分板文字透明不可见 - #175

Merged
gaoyu06 merged 2 commits into
FPSMasterTeam:mainfrom
Serendisand:fix/scoreboard-betterfont-invisible
Aug 2, 2026
Merged

fix(font): 修复 betterFont下自定义计分板文字透明不可见#175
gaoyu06 merged 2 commits into
FPSMasterTeam:mainfrom
Serendisand:fix/scoreboard-betterfont-invisible

Conversation

@Serendisand

Copy link
Copy Markdown
Contributor

根因:UFontRenderer.drawString 没有像 vanilla FontRenderer 那样把「无 alpha 位的颜色」强制为不透明(vanilla
规则:if ((color & 0xFC000000) == 0) color |= 0xFF000000)。自定义计分板以 0xFFFFFF
传色(ScoreboardComponent.java:69,73),经 betterFont 路径 Alpha.apply 后 alpha 仍为 0,TextRenderer
把所有四边形的 alpha 写成 0 → 文字全透明。而计分板背景默认是透明黑,所以整块「消失」。其他 HUD 都传 -1
或带显式 alpha,所以只有计分板中招。

UFontRenderer.drawString 未按 vanilla 规则把无 alpha 位的颜色强制为不透明,
ScoreboardComponent 以 0xFFFFFF 传色,经自定义字体路径渲染后 alpha=0 全透明,
导致开启"更好的字体"后自定义计分板整块消失(背景默认透明)。
按 FontRenderer 的规则在 edge$drawStringInternal 中补齐。
@Serendisand

Copy link
Copy Markdown
Contributor Author

fix #174

…de solid

Forcing a colour with no alpha bits to opaque is right for UFontRenderer - it
extends FontRenderer and is handed around as one, LevelTag picks between it and
fontRendererObj at runtime, so a vanilla-shaped colour has to mean there what it
means everywhere else. But it costs the alpha 1-3 band, and the client was
running fades straight through it.

The OOBE greeting crossfade is the one that shows. previousAlpha is cubic, so it
sits at or below three for the last thirty-odd frames of the half-second fade,
and the greeting rotates every 2.2s: the outgoing text would have held full
opacity for half a second and then vanished. The tutorial slide is smaller -
updateTutorialAutoplay resets the transition after updateAnimations has advanced
it, so the frame a slide flips renders at exactly zero and would pop in solid.
Both stop at four now, which is what MixinGuiNewChat already does and what every
other fade in the client already did by guarding above the band.

Component colours come from ColorSetting, whose alpha slider reaches zero and
whose Wave mode scales what it returns, so Component.drawString takes alpha at
its word and draws nothing below four. That is the opposite dialect to the
renderer's, which is fine - they are different layers - and it leaves shapes
alone: backgrounds go through drawRect and never come past here, so a fully
transparent background stays transparent. The custom scoreboard was the one
component writing vanilla's spelling of opaque white; it passes -1 now, like the
other twelve.

Co-Authored-By: Claude <noreply@anthropic.com>
@gaoyu06
gaoyu06 merged commit acca9a2 into FPSMasterTeam:main Aug 2, 2026
3 checks passed
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