-
Bug
-
Resolution: Fixed
-
Minor
-
None
-
None
-
Not related to error.
-
This server is running CraftBukkit version git-Spigot-57bbdd8-dea4138 (MC: 1.16.3) (Implementing API version 1.16.3-R0.1-SNAPSHOT)
-
Yes
While making a book-parsing method I spent about a night and a morning trying to figure out why the line-wrapping was not working.
To reproduce:
MinecraftFont font = new MinecraftFont(); System.out.println("pixels wide: " + font.getWidth("Homeblocks have an HP")); System.out.println("space char is " + font.getWidth(" ") + " pixels wide.");
which will output:
pixels wide: 112
space char is 2 pixels wide.
The maximum pixel count for a line is 113.
The screenshot below shows how the above test string actually renders in game.
The reference for the font shows the space character as having 3 pixels and I am inclined to believe them: https://minecraft.gamepedia.com/Language#Font after I added a pixel for every space to my line parser's lineWidth it worked perfectly.