Skip to content

Font System

curveo edited this page May 12, 2026 · 1 revision

Font System

TesseraUI uses Minecraft's font rendering and supports custom fonts registered through resource packs.


Default font

The default font is the standard Minecraft bitmap font. No configuration is needed; it is used automatically when no font-family is specified.


Registering a custom font

Create a font definition file under the tesseraui namespace:

assets/tesseraui/font/mono.json
assets/tesseraui/font/fantasy.json

Font definition format (standard Minecraft font provider JSON):

{
  "providers": [
    {
      "type": "bitmap",
      "file": "tesseraui:font/mono.png",
      "ascent": 7,
      "height": 8,
      "chars": [
        " !"#..."
      ]
    }
  ]
}

Refer to the Minecraft Wiki — Font for the full provider format.


Using a custom font in CSS

.code-block {
  font-family: mono;
  font-size:   7px;
  color:       #A0C8A0;
}

.title {
  font-family: fantasy;
  font-size:   10px;
}

TesseraUI resolves font-family: mono to the tesseraui:font/mono.json definition. Falls back to the default Minecraft font if the resource is absent.


Using a custom font in Java

label.font("mono");
label.font("mono", 7f);   // with explicit size

button.font("fantasy");

Font scaling

TesseraUI scales fonts by the ratio fontSize / naturalPx. The natural pixel size of the default Minecraft font is 8 px.

/* Renders at exactly 6 px — scaled down from natural 8 px */
.small { font-size: 6px; }

/* Renders at exactly 10 px — scaled up */
.large { font-size: 10px; }

font-weight

The Minecraft font does not have a true bold variant. TesseraUI simulates bold by drawing the text with a slight shadow offset, similar to Minecraft's own bold formatting.

.heading { font-weight: bold; }   /* or font-weight: 700 */
.body    { font-weight: normal; } /* or font-weight: 400 */

Clone this wiki locally