OffsetFontUtil

public final class OffsetFontUtil

Builds invisible "negative space" font strings used to position boss-bar dialogue content horizontally without touching the actual text glyphs (so every language keeps rendering in Minecraft's native fonts).

The matching glyphs are declared in em_rsp_defaults/.../font/default.json:

  • BOX_GLYPH (U+F0F00) renders elitemobs:gui/dialoguebox.png.
  • A space provider maps U+F0F01..U+F0F0A to advances +1..+512 and U+F0F11..U+F0F1A to advances -1..-512.
Any pixel advance is composed by summing those power-of-two glyphs.

Properties

Link copied to clipboard
public final static String BOX_GLYPH
The dialogue box is wider than Minecraft's 256px bitmap-glyph limit, so it is sliced into two halves rendered side by side.
Link copied to clipboard
public final static String BOX_GLYPH_RIGHT

Functions

Link copied to clipboard
public static String boxGlyph()
The two box halves joined into one renderable string.
Link copied to clipboard
public static String pixels(int advance)
Returns an invisible string whose total horizontal advance equals advance pixels.
Link copied to clipboard
public static String shift(String content, int pixelsRight)
Shifts a (boss-bar centered) piece of content horizontally by pixelsRight pixels, independent of the content's own width.
Link copied to clipboard
public static int totalAdvance(String string)
Sums the advances of the offset glyphs in a string (other characters are ignored).