-
Notifications
You must be signed in to change notification settings - Fork 0
Font System
TesseraUI uses Minecraft's font rendering and supports custom fonts registered through resource packs.
The default font is the standard Minecraft bitmap font. No configuration is needed; it is used automatically when no font-family is specified.
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.
.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.
label.font("mono");
label.font("mono", 7f); // with explicit size
button.font("fantasy");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; }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 */