Rendering Text
How to load fonts and render styled text in Takumi
Takumi comes with pre-bundled fonts Geist and Geist Mono for @takumi-rs/core
. This is to minimize the binary size for embedded Takumi versions.
Supported Font Formats
ttf
otf
woff
woff2
Woff2 is recommended for environments which has file size constraint like Cloudflare Workers or Browser.
Default Font fallback
Takumi appends every possible font family to the font stack when you load it in order, you can override this behavior by passing a fontFamily
property to the node tree.
For @takumi-rs/core
, the pre-bundled fonts will only load if the fonts
array are not provided, or you can explicitly load them by passing loadDefaultFonts: true
to the renderer constructor.