No matching definitions.

raylib/text

src/raylib/text.tur
defn

load-font

(load-font [path :cstr] :int)

load a TrueType or AngelCode font from a file.

pathfilesystem path to the font file (.ttf, .otf, .fnt, ...)

Opaque :int handle to a heap-allocated Font struct.

(let [f (load-font "roboto.ttf")] ...)

Since: P3

defn

unload-font

(unload-font [font :int] :void)

free a font from GPU and CPU memory.

fontFont handle from load-font
(unload-font f)

Since: P3

defn

draw-text

(draw-text [text :cstr x :int y :int size :int col :int] :void)

draw a string using the default built-in font.

textNUL-terminated string to draw
xleft edge (pixels)
ytop edge (pixels)
sizefont size in pixels
colColor handle
(draw-text "Hello!" 10 10 24 (white))

Since: P3

defn

draw-text-ex

(draw-text-ex [font :int text :cstr px :float py :float size :float spacing :float col :int] :void)

draw a string with a loaded Font, position, size, spacing, and color.

fontFont handle from load-font
textNUL-terminated string to draw
px py -- position (pixels) as floats for sub-pixel accuracy
sizefont size in pixels (float)
spacingextra spacing between glyphs (float)
colColor handle
(draw-text-ex f "Score: 42" 10.0 10.0 32.0 1.5 (white))

Since: P3

defn

measure-text

(measure-text [text :cstr size :int] :int)

measure the pixel width of a string rendered at a given size.

textNUL-terminated string
sizefont size in pixels (using the default built-in font)

Width of the rendered string in pixels as :int.

(let [w (measure-text "Hello" 24)] ...)

Since: P3