
# Fonts

`fonts` registers custom typefaces for [canvas](canvas.md) text.

| Function | Does |
|----------|------|
| `fonts.register(name, path[, antialias])` | Loads a TTF or OTF file. The path is relative to the scripts folder, absolute paths work too. `antialias` defaults to `true` |
| `fonts.exists(name)` | `true` when a font with that name is registered |

```lua
fonts.register("pixel", "fonts/pixel.ttf")
render.text("Hi", 8, 8, 12, nil, "pixel")
```

Registering the same name again replaces the font, which keeps hot-reload working. Built-in
fonts cannot be replaced.

## The vanilla font

`"minecraft"` renders the real in-game font. Glyphs come from the game's font providers, so
resource packs and Force Unicode apply on their own.

Size is line height in pixels: `9` matches vanilla at GUI scale 1, `18` at scale 2. Shaping is
vanilla-faithful, one glyph per code point, no kerning or ligatures.

```lua
render.text("Diamonds: 12", 8, 8, 18, nil, "minecraft")
```

The paint color tints glyphs the way vanilla text color does. Colored glyphs from
emoji-style packs keep their own colors.
