LoadFont

Load a TTF/OTF font into ImGui and return its handle.

Syntax

Susano.LoadFont(path, size_px) -> number

Parameters

path (string): Absolute or relative path to a TTF/OTF file.

size_px (number): Native pixel size for this font.

Return(s)

fontId (number): Handle to use with Susano.PushFont.

On error: nil, err (string).

Behavior

Registers the font in the Susano renderer atlas. Must be called once for each font.

The returned fontId is valid for the current session.

Does not change the active font by itself.

Example(s)

local ok, sx, sy = Susano.WorldToScreen(250.0, -1040.0, 29.0)
local id, err = Susano.LoadFont("C:/Windows/Fonts/Consola.ttf", 18)
if not id then 
    print(err) 
end

Last updated