Plain text that follows bold obfuscated text shakes left and right as the obfuscated characters cycle through random glyphs.
Steps to reproduce:
Run the following command:
/tellraw @s {"text":"","extra":[{"text":"Hello, ","obfuscated":true,"bold":true},{"text":" World!"}]}
Observe horizontal shake in the " World!" text that appears after the bold obfuscated portion
Expected behavior: Text following bold obfuscated text should remain in a consistent position
Actual behavior: The text after the obfuscated portion jumps left and right
Code analysis:
The rendering code now uses the advance width from the randomly selected baked glyph for positioning. However, Font#getGlyph
appears to be calling GlyphInfo#getAdvance(false)
(non-bold) to determine characters for lookup even when rendering bold text. Glyphs using oversampling introduce fractional advances such that bold styling changes their effective width after rounding, causing changing and inconsistent positioning that affects subsequent text. Previously, the code did not use the returned random baked glyph's advance for positioning, but the original’s only, which had masked this issue.
Environment
Java Version: OpenJDK 21.0.7+6-LTS
OS: Windows 10 64-bit
System Memory: 15GB
JVM Memory: 2GB
Here is a video of this issue impacting game chat on a third party server. Such custom formatting is often seen in player names/ranks, posing a problem for supporting 1.21.9+ for impacted servers.