DRAWING FUNCTIONS
LoadFont
Loads a font from disk and returns its handle.
Syntax
local fontId, err = ONYX.LoadFont(path, size_px)Parameters
path(string) — Absolute or relative path to an OTF/TTF file.size_px(number) — Native pixel size for this font.
Return(s)
fontId (number) — handle for PushFont; on error nil and a string message.
Behavior
- Registers the font in the renderer atlas; call it once per font.
- The returned handle stays valid for the session.
- Loading a font does not change the active font by itself.
Example(s)
local fontId, err = ONYX.LoadFont("C:/fonts/Inter.ttf", 18)
if not fontId then print(err) end