You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue may be related to #845 but still occurs in versions where aforementioned bug does not.
Summary
The default font renderer cuts too early in trimStringToWidth(String,int) for certain inputs using certain resource packs (possibly related to HD fonts).
Example
String text = "30"
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
int width = fontRenderer.getStringWidth(text); // width is 12, same as in vanilla
fontRenderer.listFormattedStringToWidth(text, width + 1);
// ^ this, for comparison, works as expected: ["30"]
fontRenderer.trimStringToWidth(text, width);
// ^ expected "30" but is "3"
fontRenderer.trimStringToWidth(text, width + 1);
// ^ As expected: "30"
Environment
Minecraft: 1.12.2
Optifine: 1.12.2_HD_U_C9
Forge: build 2611
No other mods (IntelliJ Remote Debugging for testing)
Resource Pack used for the Example: PureBDcraft 256x MC112 (download link)
The text was updated successfully, but these errors were encountered:
Internally OptiFine uses float character widths to allow finer tuning of character spacing.
The string "30" in BDCraft font has width "12.25". It is rounded to 12 when returned from getStringWidth().
Solution A: Round down when comparing the width, then the string may be rendered a bit wider.
Solution B: Round up the width returned from getStringWidth(), then rendered width may be smaller.
This issue may be related to #845 but still occurs in versions where aforementioned bug does not.
Summary
The default font renderer cuts too early in
trimStringToWidth(String,int)for certain inputs using certain resource packs (possibly related to HD fonts).Example
Environment
Minecraft: 1.12.2
Optifine: 1.12.2_HD_U_C9
Forge: build 2611
No other mods (IntelliJ Remote Debugging for testing)
Resource Pack used for the Example: PureBDcraft 256x MC112 (download link)
The text was updated successfully, but these errors were encountered: