Skip to content
JoeStrout edited this page Nov 16, 2026 · 4 revisions

RText

Name Parameters Purpose
LoadFont fileName Load a Font from file into GPU memory (VRAM). Returns null on failure
LoadFontEx fileName, fontSize=20, codepoints=null, codepointCount=0 Load a font from file at fontSize (in pixels of height), with the given codepoints (a list of ints or a string of characters); null codepoints loads the default character set (32..126). codepointCount is ignored. Returns null on failure
LoadFontFromImage image, key=Color{255, 0, 255, 255}, firstChar=32 Load a font from an Image (XNA style): glyphs separated by key color, starting at firstChar (a codepoint or a one-character string)
IsFontValid font Check if font is valid (font data loaded). WARNING: GPU texture not checked
UnloadFont font Unload Font from GPU memory (VRAM)
MakeFont baseSize, glyphs, recs, texture, glyphPadding=0 Build a Font from its parts, e.g. for an SDF font. glyphs is a list of maps (value, offsetX, offsetY, advanceX, image), recs a matching list of each glyph's rectangle in texture. The font takes over texture, so UnloadFont unloads it; glyph images are copied. Returns null if the lists are empty or differ in length, or the font is not valid
DrawFPS posX=0, posY=0 Draw current FPS, using the default font
DrawText text, posX=0, posY=0, fontSize=20, color=BLACK Draw text using the default font. If fontSize is smaller than the font's base size (10), the base size is used. Character spacing is proportional to fontSize
DrawTextEx font, text, position=[0, 0], fontSize=20, spacing=0, tint=BLACK Draw text using Font. Character spacing is NOT proportional to fontSize
DrawTextPro font, text, position=[0, 0], origin=[0, 0], rotation=0, fontSize=20, spacing=0, tint=BLACK Draw text using Font, rotated (in degrees) around origin
DrawTextCodepoint font, codepoint, position=[0, 0], fontSize=20, tint=BLACK Draw one character, given as an int codepoint
MeasureText text, fontSize=20 Measure text width in pixels, for the default font
MeasureTextEx font, text, fontSize=20, spacing=0 Measure text size for Font; returns a map with x (width) and y (height)
MeasureTextCodepoints font, codepoints, fontSize=20, spacing=0 Measure size of codepoints (a list of ints or a string) for Font; returns a map with x (width) and y (height)
GetGlyphIndex font, codepoint Get the glyph index of a Unicode codepoint in font. If codepoint is not found in the font, it falls back to '?'
GetFontDefault Get the default font
SetTextLineSpacing spacing Set vertical line spacing when drawing with line-breaks
GetGlyphAtlasRec font, codepoint Get glyph rectangle in font atlas for a codepoint (Unicode character). If codepoint is not found in the font, it falls back to '?'
GetGlyphInfo font, codepoint Get glyph info for a codepoint (Unicode character), as a map with value, offsetX, offsetY, advanceX and image. If codepoint is not found in the font, it falls back to '?'
GetCodepointCount text Get the number of characters (codepoints) in text. An invalid UTF-8 sequence counts as one '?' (0x3f) codepoint
CodepointToUTF8 codepoint Get the character for a Unicode codepoint, as a string
TextIsEqual text1, text2 Check if two text strings are equal
TextLength text Get the length of a string in bytes (of UTF-8), not characters
TextCopy dst, src Returns src unchanged (dst is ignored, since MiniScript strings cannot be modified)
LoadFontFromMemory fileType, fileData, fontSize, codepoints=null, codepointCount=0 Load a font from a RawData buffer. fileType is the file extension, e.g. ".ttf". codepoints is a list of ints or a string (null for the default set, 32..126); codepointCount is ignored. Returns null on failure
LoadFontData fileData, fontSize, codepoints=null, codepointCount=0, type=0 Load glyph data from TTF font data (a RawData), for use with GenImageFontAtlas or MakeFont. codepoints is a list of ints or a string (null for 32..126); codepointCount is ignored. type: 0 = default, 1 = bitmap, 2 = SDF. Returns a list of glyph maps (value, offsetX, offsetY, advanceX, image); release the images with UnloadFontData
UnloadFontData glyphs Unload the glyph images in a list of glyph maps returned by LoadFontData
LoadCodepoints text Get all codepoints in a text string, as a list of ints
UnloadCodepoints codepoints Does nothing (codepoint lists are freed automatically); kept for raylib compatibility
LoadUTF8 codepoints Encode codepoints (a list of ints) into a UTF-8 string
UnloadUTF8 text Does nothing (strings are freed automatically); kept for raylib compatibility
DrawTextCodepoints font, codepoints, position=[0, 0], fontSize=20, spacing=0, tint=BLACK Draw multiple characters, given as a list of int codepoints or a string
GenImageFontAtlas glyphs, glyphRecs, fontSize, padding, packMethod Generate a font atlas Image from glyphs (a list of glyph maps, as from LoadFontData). glyphRecs is a list of the same length, which is filled with each glyph's rectangle in the atlas. packMethod: 0 = default, 1 = Skyline. Returns null if the lists are empty or differ in length
TextFormat text, args=[] Format text, replacing each %s, %d (or %i) and %f with the next value from args, and %% with %
TextFindIndex text, search Find first occurrence of search within text; returns its byte index, or -1 if not found
GetTextBetween text, begin, end Get the text between the first occurrence of begin and the next end after it ("" if not found). Result is limited to 1023 bytes
TextReplace text, search, replacement Replace all occurrences of search in text with replacement. Result is limited to 1023 bytes; use TextReplaceAlloc for longer text
TextReplaceAlloc text, search, replacement Replace all occurrences of search in text with replacement, with no length limit
TextReplaceBetween text, begin, end, replacement Replace the text between begin and end (keeping begin and end) with replacement; an empty or null replacement just removes it. Result is limited to 1023 bytes; use TextReplaceBetweenAlloc for longer text
TextReplaceBetweenAlloc text, begin, end, replacement Replace the text between begin and end (keeping begin and end) with replacement, with no length limit; an empty or null replacement just removes it
TextInsert text, insert, position Insert text at a byte position, moving the rest forward. Result is limited to 1023 bytes; use TextInsertAlloc for longer text
TextSubtext text, position=0, length=0 Get part of a string: length bytes from byte position (bytes of UTF-8, not characters)
TextRemoveSpaces text Remove all the spaces from a string. Result is limited to 1023 bytes
TextInsertAlloc text, insert, position Insert text at a byte position, moving the rest forward, with no length limit
TextSplit text, delimiter Split text at each occurrence of delimiter (its first character only) into a list of at most 128 strings; null if delimiter is empty
TextJoin textList, delimiter="" Join a list of strings with delimiter. Result is limited to 1023 bytes
TextAppend text, append Returns text with append added to the end
TextToUpper text Get upper case version of provided string. Only basic (ASCII) letters are converted; result is limited to 1023 bytes
TextToLower text Get lower case version of provided string. Only basic (ASCII) letters are converted; result is limited to 1023 bytes
TextToPascal text Get PascalCase version of provided string (from snake_case). Only basic (ASCII) characters are handled; result is limited to 1023 bytes
TextToSnake text Get snake_case version of provided string. Only basic (ASCII) characters are handled; result is limited to 1023 bytes
TextToCamel text Get camelCase version of provided string (from snake_case). Only basic (ASCII) characters are handled; result is limited to 1023 bytes
TextToInteger text Get integer value from text
TextToFloat text Get float value from text. Only '.' is understood as decimal point
LoadTextLines text Split text into a list of lines, at each line feed
UnloadTextLines lines Does nothing (lists are freed automatically); kept for raylib compatibility

Clone this wiki locally