Module for font rendering. Unicode is supported, but only left to right.

interface Font

type Font* = interface { // Draw text to the viewport draw(text: str, pos: th::Vf2, color: uint32, scale: th::fu = 1.0) // Return the dimensions of the text at scale 1 measure(text: str): th::Vf2 // Return true if the font is valid validate(): bool }

A generic interface for fonts. Fonts can be loaded from file using font::load, or a built in canvas can be used from canvas::pixelFont.

fn load

fn load*(path: str, size: th::fu, filter: image::Filter = .linear): (Font, std::Err) {

Loads a font from a path and returns it.