v2026.5.3
All Bundles
Bundle SDL2 multimedia library for 2D graphics, input handling, audio playback, and window management. Core types: Window, Renderer, Texture, Surface, Event, and Mixer. Compile with -lib sdl2.

Font

TrueType font rendering

Operations

Init # function

Initialize the TrueType font APIs

function : Init() ~ Int

IsNull #

Determines if the underlying SDL C-struct is NULL

method : public : IsNull() ~ Bool

Return

TypeDescription
Booltrue if NULL, false otherwise

New # constructor

Load file for use as a font, this can load TTF and FON files.

New(file:String, ptsize:Int)

Parameters

NameTypeDescription
fileStringfile name to load font from.
ptsizeIntPoint size (based on 72DPI) to load font as

New # constructor

Load file for use as a font, this can load TTF and FON files.

New(file:String, ptsize:Int, index:Int)

Parameters

NameTypeDescription
fileStringfile name to load font from.
ptsizeIntPoint size (based on 72DPI) to load font as
indexIntchoose a font face from a file containing multiple font faces. The first face is always index 0.

Quit # function

Shutdown and cleanup the TrueType font APIs

function : Quit() ~ Nil

RenderTextBlended #

Render the LATIN1 encoded text blended

method : public : RenderTextBlended(text:String, fg:Color) ~ Surface

Parameters

NameTypeDescription
textStringthe LATIN1 null terminated string to render.
fgColorthe color to render the text in. This becomes colormap index 1.

Return

TypeDescription
SurfaceSurface instance, caller responsible for freeing

RenderTextShaded #

Render the LATIN1 encoded text shaded

method : public : RenderTextShaded(text:String, fg:Color, bg:Color) ~ Surface

Parameters

NameTypeDescription
textStringthe LATIN1 null terminated string to render.
fgColorthe color to render the text in. This becomes colormap index 1.
bgColorthe color to render the background box in. This becomes colormap index 0.

Return

TypeDescription
SurfaceSurface instance, caller responsible for freeing

RenderTextSolid #

Render the LATIN1 encoded text blended

method : public : RenderTextSolid(text:String, fg:Color) ~ Surface

Parameters

NameTypeDescription
textStringthe LATIN1 null terminated string to render.
fgColorthe color to render the text in. This becomes colormap index 1.

Return

TypeDescription
SurfaceSurface instance, caller responsible for freeing

RenderUTF8Blended #

Render the UTF8 encoded text blended

method : public : RenderUTF8Blended(text:String, fg:Color) ~ Surface

Parameters

NameTypeDescription
textStringthe LATIN1 null terminated string to render.
fgColorthe color to render the text in. This becomes colormap index 1.

Return

TypeDescription
SurfaceSurface instance, caller responsible for freeing

RenderUTF8Shaded #

Render the UTF8 encoded text shaded

method : public : RenderUTF8Shaded(text:String, fg:Color, bg:Color) ~ Surface

Parameters

NameTypeDescription
textStringthe LATIN1 null terminated string to render.
fgColorthe color to render the text in. This becomes colormap index 1.
bgColorthe color to render the background box in. This becomes colormap index 0.

Return

TypeDescription
SurfaceSurface instance, caller responsible for freeing

RenderUTF8Solid #

Render the UTF8 encoded text blended

method : public : RenderUTF8Solid(text:String, fg:Color) ~ Surface

Parameters

NameTypeDescription
textStringthe LATIN1 null terminated string to render.
fgColorthe color to render the text in. This becomes colormap index 1.

Return

TypeDescription
SurfaceSurface instance, caller responsible for freeing