Skip to content
JoeStrout edited this page Oct 17, 2026 · 3 revisions

RText

Name Parameters Purpose
LoadFont fileName Load Font from file into GPU memory (VRAM)
LoadFontEx fileName, fontSize=20, codepoints=null, codepointCount=0 Load font from file with defined codepoints and generation size NOTE: NULL for codepoints and 0 for codepointCount to load the default character set (32..126), font size is provided in pixels height
LoadFontFromImage image, key=Color{255, 0, 255, 255}, firstChar=32 Load an Image font file (XNA style)
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 This is needed for manual font construction, e.g. SDF fonts
DrawFPS posX=0, posY=0 Draw current FPS NOTE: Uses default font
DrawText text, posX=0, posY=0, fontSize=20, color=BLACK Draw text (using default font) NOTE: fontSize work like in any drawing program but if fontSize is lower than font-base-size, then font-base-size is used NOTE: chars spacing is proportional to fontSize
DrawTextEx font, text, position=[0, 0], fontSize=20, spacing=0, tint=BLACK Draw text using Font NOTE: chars 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 and pro parameters (rotation)
DrawTextCodepoint font, codepoint, position=[0, 0], fontSize=20, tint=BLACK Draw one character (codepoint)
MeasureText text, fontSize=20 Measure string width for default font
MeasureTextEx font, text, fontSize=20, spacing=0 Measure string size for Font
MeasureTextCodepoints font, codepoints, fontSize=20, spacing=0 Measure string size for an existing array of codepoints for Font
GetGlyphIndex font, codepoint Get index position for a unicode character on font NOTE: If codepoint is not found in the font it fallbacks 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) NOTE: If codepoint is not found in the font it fallbacks to '?'
GetGlyphInfo font, codepoint Get glyph font info data for a codepoint (unicode character) NOTE: If codepoint is not found in the font it fallbacks to '?'
GetCodepointCount text Get total number of characters(codepoints) in a UTF-8 encoded text, until '\0' is found NOTE: If an invalid UTF-8 sequence is encountered a '?'(0x3f) codepoint is counted instead
GetCodepoint text, codepointSize=null Get next codepoint in a UTF-8 encoded text, scanning until '\0' is found When an invalid UTF-8 byte is encountered, exit as soon as possible and a '?'(0x3f) codepoint is returned Total number of bytes processed are returned as a parameter NOTE: The standard says U+FFFD should be returned in case of errors but that character is not supported by the default font in raylib
GetCodepointNext text, codepointSize=null Get next codepoint in a byte sequence and bytes processed
GetCodepointPrevious text, codepointSize=null Get previous codepoint in a byte sequence and bytes processed
CodepointToUTF8 codepoint
TextIsEqual text1, text2 Check if two text strings are equal REQUIRES: strcmp()
TextLength text
TextCopy dst, src Copy one string to another, returns bytes copied NOTE: Alternative implementation to strcpy(dst, src) from C standard library
LoadFontFromMemory fileType, fileData, fontSize, codepoints=null, codepointCount=0 Load font from memory buffer, fileType refers to extension: i.e. ".ttf"
LoadFontData fileData, fontSize, codepoints=null, codepointCount=0, type=0 Load font data for further use NOTE: Requires TTF font memory data and can generate SDF data
UnloadFontData glyphs Unload font glyphs info data (RAM)
LoadCodepoints text Load all codepoints from a UTF-8 text string, codepoints count returned by parameter
UnloadCodepoints codepoints Unload codepoints data from memory
LoadUTF8 codepoints Encode text codepoint into UTF-8 text REQUIRES: memcpy() WARNING: Allocated memory must be manually freed
UnloadUTF8 text Unload UTF-8 text encoded from codepoints array
DrawTextCodepoints font, codepoints, position=[0, 0], fontSize=20, spacing=0, tint=BLACK Draw multiple characters (codepoints)
GenImageFontAtlas glyphs, glyphRecs, fontSize, padding, packMethod Generate image font atlas using chars info NOTE: Packing method: 0-Default, 1-Skyline
TextFormat text, args=[]
TextFindIndex text, search Find first text occurrence within a string REQUIRES: strstr()
GetTextBetween text, begin, end Get text between two strings
TextReplace text, search, replacement Replace text string REQUIRES: strstr(), memcpy() NOTE: Limited text replace functionality, using static string
TextReplaceAlloc text, search, replacement Replace text string REQUIRES: strstr(), memcpy() WARNING: Allocated memory must be manually freed
TextReplaceBetween text, begin, end, replacement Replace text between two specific strings REQUIRES: strncpy() NOTE: If (replacement == NULL) removes "begin"[ ]"end" text
TextReplaceBetweenAlloc text, begin, end, replacement Replace text between two specific strings REQUIRES: strncpy() NOTE: If (replacement == NULL) remove "begin"[ ]"end" text WARNING: Returned string must be freed by user
TextInsert text, insert, position Insert text in a specific position, moves all text forward WARNING: Allocated memory must be manually freed
TextSubtext text, position=0, length=0
TextRemoveSpaces text
TextInsertAlloc text, insert, position Insert text in a specific position, moves all text forward WARNING: Allocated memory must be manually freed
TextSplit text, delimiter
TextJoin textList, delimiter="" Join text strings with delimiter REQUIRES: memset(), memcpy()
TextAppend text, append Append text at specific position and move cursor WARNING: It's up to the user to make sure appended text does not overflow the buffer!
TextToUpper text Get upper case version of provided string WARNING: Limited functionality, only basic characters set TODO: Support UTF-8 diacritics (á, ñ, ü...) to upper-case, check codepoints
TextToLower text Get lower case version of provided string WARNING: Limited functionality, only basic characters set
TextToPascal text Get Pascal case notation version of provided string WARNING: Limited functionality, only basic characters set
TextToSnake text Get snake case notation version of provided string WARNING: Limited functionality, only basic characters set
TextToCamel text Get Camel case notation version of provided string WARNING: Limited functionality, only basic characters set
TextToInteger text Get integer value from text NOTE: This function replaces atoi() [stdlib.h]
TextToFloat text Get float value from text NOTE: This function replaces atof() [stdlib.h] WARNING: Only '.' character is understood as decimal point
LoadTextLines text
UnloadTextLines lines Unload text lines

Clone this wiki locally