rl.getFontDefault
Get the default Font
Zigfn getFontDefault() FontCFont GetFontDefault(void);Used in core_2d_camera_mouse_zoom, core_highdpi_demo, core_text_file_loading, shapes_pie_chart, text_font_filters, text_rectangle_bounds and 5 more.
Fonts, text drawing, codepoints and strings. 59 functions, from raylib's rtext.
Get the default Font
Zigfn getFontDefault() FontCFont GetFontDefault(void);Used in core_2d_camera_mouse_zoom, core_highdpi_demo, core_text_file_loading, shapes_pie_chart, text_font_filters, text_rectangle_bounds and 5 more.
Load font from file into GPU memory (VRAM)
Zigfn loadFont(fileName: [:0]const u8) error{LoadFailed}!FontCFont LoadFont(const char *fileName);Used in textures_image_drawing, text_sprite_fonts, text_font_spritefont, text_font_loading, text_unicode_emojis, text_unicode_ranges and 1 more.
Load font from file with defined codepoints and generation size, use NULL for codepoints and 0 for codepointCount to load the default character set, font size is provided in pixels height
Zigfn loadFontEx(fileName: [:0]const u8, fontSize: i32, codepoints: ?[]const i32) error{LoadFailed}!FontCFont LoadFontEx(const char *fileName, int fontSize, const int *codepoints, int codepointCount);Used in textures_image_text, text_font_filters, text_font_loading, text_unicode_ranges, text_3d_drawing, text_codepoints_loading.
Load font from Image (XNA style)
Zigfn loadFontFromImage(image: Image, key: Color, firstChar: i32) error{LoadFailed}!FontCFont LoadFontFromImage(Image image, Color key, int firstChar);Load font from memory buffer, fileType refers to extension: i.e. '.ttf'
Zigfn loadFontFromMemory(fileType: [:0]const u8, fileData: []const u8, fontSize: i32, codepoints: ?[]const i32) error{LoadFailed}!FontCFont LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int dataSize, int fontSize, const int *codepoints, int codepointCount);Check if font is valid (font data loaded, WARNING: GPU texture not checked)
Zigfn isFontValid(font: Font) boolCbool IsFontValid(Font font);Load font data for further use
Load font data for further use. Free with `unloadFontData`.
Zigfn loadFontData(fileData: []const u8, fontSize: i32, codepoints: ?[]const i32, @"type": FontType) error{LoadFailed}![]GlyphInfoCGlyphInfo *LoadFontData(const unsigned char *fileData, int dataSize, int fontSize, const int *codepoints, int codepointCount, int type, int *glyphCount);Used in text_font_sdf.
Generate image font atlas using chars info
Generate image font atlas using chars info. `glyphRecs` receives a raylib-allocated rectangle array (typically `&font.recs`; freed by `unloadFont`, or with `memFree`).
Zigfn genImageFontAtlas(glyphs: []const GlyphInfo, glyphRecs: *?[*]Rectangle, fontSize: i32, padding: i32, packMethod: i32) ImageCImage GenImageFontAtlas(const GlyphInfo *glyphs, Rectangle **glyphRecs, int glyphCount, int fontSize, int padding, int packMethod);Used in text_font_sdf.
Unload font chars info data (RAM)
Zigfn unloadFontData(glyphs: []GlyphInfo) voidCvoid UnloadFontData(GlyphInfo *glyphs, int glyphCount);Unload font from GPU memory (VRAM)
Zigfn unloadFont(font: Font) voidCvoid UnloadFont(Font font);Used in textures_image_drawing, textures_image_text, text_sprite_fonts, text_font_spritefont, text_font_filters, text_font_loading and 5 more.
Export font as code file, returns true on success
Zigfn exportFontAsCode(font: Font, fileName: [:0]const u8) boolCbool ExportFontAsCode(Font font, const char *fileName);Draw current FPS
Zigfn drawFPS(posX: i32, posY: i32) voidCvoid DrawFPS(int posX, int posY);Used in core_3d_camera_mode, core_3d_picking, core_window_flags, core_vr_simulator, core_smooth_pixelperfect, core_random_sequence and 60 more.
Draw text (using default font)
Zigfn drawText(text: [:0]const u8, posX: i32, posY: i32, fontSize: i32, color: Color) voidCvoid DrawText(const char *text, int posX, int posY, int fontSize, Color color);Used in core_basic_window, core_delta_time, core_input_keys, core_input_mouse, core_input_mouse_wheel, core_input_gamepad and 186 more.
Draw text using font and additional parameters
Zigfn drawTextEx(font: Font, text: [:0]const u8, position: Vector2, fontSize: f32, spacing: f32, tint: Color) voidCvoid DrawTextEx(Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint);Used in core_2d_camera_mouse_zoom, core_highdpi_demo, textures_image_text, text_sprite_fonts, text_font_spritefont, text_font_filters and 7 more.
Draw text using Font and pro parameters (rotation)
Zigfn drawTextPro(font: Font, text: [:0]const u8, position: Vector2, origin: Vector2, rotation: f32, fontSize: f32, spacing: f32, tint: Color) voidCvoid DrawTextPro(Font font, const char *text, Vector2 position, Vector2 origin, float rotation, float fontSize, float spacing, Color tint);Draw one character (codepoint)
Zigfn drawTextCodepoint(font: Font, codepoint: i32, position: Vector2, fontSize: f32, tint: Color) voidCvoid DrawTextCodepoint(Font font, int codepoint, Vector2 position, float fontSize, Color tint);Used in text_rectangle_bounds, text_unicode_emojis, text_inline_styling.
Draw multiple characters (codepoint)
Zigfn drawTextCodepoints(font: Font, codepoints: []const i32, position: Vector2, fontSize: f32, spacing: f32, tint: Color) voidCvoid DrawTextCodepoints(Font font, const int *codepoints, int codepointCount, Vector2 position, float fontSize, float spacing, Color tint);Set vertical line spacing when drawing with line-breaks
Zigfn setTextLineSpacing(spacing: i32) voidCvoid SetTextLineSpacing(int spacing);Used in text_font_loading, text_codepoints_loading.
Measure string width for default font
Zigfn measureText(text: [:0]const u8, fontSize: i32) i32Cint MeasureText(const char *text, int fontSize);Used in core_3d_picking, core_world_screen, core_text_file_loading, shapes_colors_palette, shapes_collision_area, shapes_digital_clock and 7 more.
Measure string size for Font
Zigfn measureTextEx(font: Font, text: [:0]const u8, fontSize: f32, spacing: f32) Vector2CVector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing);Used in core_highdpi_demo, core_text_file_loading, shapes_pie_chart, text_sprite_fonts, text_font_spritefont, text_font_filters and 4 more.
Measure string size for an existing array of codepoints for Font
Zigfn measureTextCodepoints(font: Font, codepoints: []const i32, fontSize: f32, spacing: f32) Vector2CVector2 MeasureTextCodepoints(Font font, const int *codepoints, int length, float fontSize, float spacing);Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found
Zigfn getGlyphIndex(font: Font, codepoint: i32) i32Cint GetGlyphIndex(Font font, int codepoint);Used in text_rectangle_bounds, text_unicode_emojis, text_3d_drawing, text_inline_styling.
Get glyph font info data for a codepoint (unicode character), fallback to '?' if not found
Zigfn getGlyphInfo(font: Font, codepoint: i32) GlyphInfoCGlyphInfo GetGlyphInfo(Font font, int codepoint);Get glyph rectangle in font atlas for a codepoint (unicode character), fallback to '?' if not found
Zigfn getGlyphAtlasRec(font: Font, codepoint: i32) RectangleCRectangle GetGlyphAtlasRec(Font font, int codepoint);Load UTF-8 text encoded from codepoints array
Load UTF-8 text encoded from codepoints array. Free with `unloadUTF8`.
Zigfn loadUTF8(codepoints: []const i32) error{LoadFailed}![:0]u8Cchar *LoadUTF8(const int *codepoints, int length);Unload UTF-8 text encoded from codepoints array
Unload UTF-8 text encoded from codepoints array.
Zigfn unloadUTF8(text: [:0]u8) voidCvoid UnloadUTF8(char *text);Load all codepoints from a UTF-8 text string, codepoints count returned by parameter
Load all codepoints from a UTF-8 text string. Free with `unloadCodepoints`.
Zigfn loadCodepoints(text: [:0]const u8) error{LoadFailed}![]i32Cint *LoadCodepoints(const char *text, int *count);Used in textures_image_text, text_codepoints_loading.
Unload codepoints data from memory
Unload codepoints data from memory.
Zigfn unloadCodepoints(codepoints: []i32) voidCvoid UnloadCodepoints(int *codepoints);Used in textures_image_text, text_codepoints_loading.
Get total number of codepoints in a UTF-8 encoded string
Zigfn getCodepointCount(text: [:0]const u8) i32Cint GetCodepointCount(const char *text);Used in text_unicode_emojis.
Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure
Get next codepoint in a UTF-8 encoded string and its size in bytes; 0x3f('?') on failure.
Zigfn getCodepoint(text: [:0]const u8) CodepointResultCint GetCodepoint(const char *text, int *codepointSize);Used in text_rectangle_bounds, text_unicode_emojis, text_3d_drawing.
Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure
Get next codepoint in a UTF-8 encoded string and its size in bytes; 0x3f('?') on failure.
Zigfn getCodepointNext(text: [:0]const u8) CodepointResultCint GetCodepointNext(const char *text, int *codepointSize);Used in text_codepoints_loading, text_inline_styling.
Get previous codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure
Get previous codepoint in a UTF-8 encoded string and its size in bytes; 0x3f('?') on failure.
Zigfn getCodepointPrevious(text: [:0]const u8) CodepointResultCint GetCodepointPrevious(const char *text, int *codepointSize);Used in text_codepoints_loading.
Encode one codepoint into UTF-8 byte array (array length returned as parameter)
Encode one codepoint into UTF-8 bytes (slice into a static buffer).
Zigfn codepointToUTF8(codepoint: i32) []const u8Cconst char *CodepointToUTF8(int codepoint, int *utf8Size);Load text as separate lines ('\n')
Load text as separate lines ('\n'). Free with `unloadTextLines`.
Zigfn loadTextLines(text: [:0]const u8) error{LoadFailed}![][*:0]u8Cchar **LoadTextLines(const char *text, int *count);Used in core_text_file_loading.
Unload text lines
Unload text lines loaded with `loadTextLines`.
Zigfn unloadTextLines(lines: [][*:0]u8) voidCvoid UnloadTextLines(char **text, int lineCount);Used in core_text_file_loading.
Copy one string to another, returns bytes copied
Copy one string to another, returns bytes copied. `dst` must be large enough for `src` plus its terminator (C semantics, unchecked).
Zigfn textCopy(dst: [*]u8, src: [:0]const u8) i32Cint TextCopy(char *dst, const char *src);Used in core_drop_files, core_directory_files, models_skybox_rendering.
Check if two text strings are equal
Zigfn textIsEqual(text1: [:0]const u8, text2: [:0]const u8) boolCbool TextIsEqual(const char *text1, const char *text2);Used in text_unicode_emojis.
Get text length, checks for '\0' ending
Zigfn textLength(text: [:0]const u8) u32Cunsigned int TextLength(const char *text);Text formatting with variables (sprintf() style)
Text formatting with variables (std.fmt syntax). Like raylib's TextFormat, the result lives in one of a few internal static buffers: it is valid until the same buffer is reused several calls later. Truncates at 1023 bytes.
Zigfn textFormat(comptime format: []const u8, args: anytype) [:0]const u8Cconst char *TextFormat(const char *text, ...);Used in core_delta_time, core_input_mouse_wheel, core_input_gamepad, core_input_multitouch, core_input_gestures_testbed, core_2d_camera_mouse_zoom and 101 more.
Get a piece of a text string
Zigfn textSubtext(text: [:0]const u8, position: i32, length: i32) [:0]const u8Cconst char *TextSubtext(const char *text, int position, int length);Used in core_input_gestures_testbed, shapes_logo_raylib_anim, text_writing_anim, text_strings_management.
Remove text spaces, concat words
Zigfn textRemoveSpaces(text: [:0]const u8) [:0]const u8Cconst char *TextRemoveSpaces(const char *text);Get text between two strings
Zigfn getTextBetween(text: [:0]const u8, begin: [:0]const u8, end: [:0]const u8) [:0]const u8Cchar *GetTextBetween(const char *text, const char *begin, const char *end);Replace text string with new string
Zigfn textReplace(text: [:0]const u8, search: [:0]const u8, replacement: [:0]const u8) [:0]const u8Cchar *TextReplace(const char *text, const char *search, const char *replacement);Replace text string with new string, memory must be MemFree()
Caller owns the result: free with `memFree`.
Zigfn textReplaceAlloc(text: [:0]const u8, search: [:0]const u8, replacement: [:0]const u8) ?[:0]u8Cchar *TextReplaceAlloc(const char *text, const char *search, const char *replacement);Replace text between two specific strings
Zigfn textReplaceBetween(text: [:0]const u8, begin: [:0]const u8, end: [:0]const u8, replacement: [:0]const u8) [:0]const u8Cchar *TextReplaceBetween(const char *text, const char *begin, const char *end, const char *replacement);Replace text between two specific strings, memory must be MemFree()
Caller owns the result: free with `memFree`.
Zigfn textReplaceBetweenAlloc(text: [:0]const u8, begin: [:0]const u8, end: [:0]const u8, replacement: [:0]const u8) ?[:0]u8Cchar *TextReplaceBetweenAlloc(const char *text, const char *begin, const char *end, const char *replacement);Insert text in a defined byte position
Zigfn textInsert(text: [:0]const u8, insert: [:0]const u8, position: i32) [:0]const u8Cchar *TextInsert(const char *text, const char *insert, int position);Insert text in a defined byte position, memory must be MemFree()
Caller owns the result: free with `memFree`.
Zigfn textInsertAlloc(text: [:0]const u8, insert: [:0]const u8, position: i32) ?[:0]u8Cchar *TextInsertAlloc(const char *text, const char *insert, int position);Join text strings with delimiter
Join text strings with delimiter (static memory).
Zigfn textJoin(textList: []const [*:0]const u8, delimiter: [:0]const u8) [:0]const u8Cchar *TextJoin(char **textList, int count, const char *delimiter);Split text into multiple strings, using MAX_TEXTSPLIT_COUNT static strings
Split text into multiple strings (static memory, valid until the next call).
Zigfn textSplit(text: [:0]const u8, delimiter: u8) []const [*:0]const u8Cchar **TextSplit(const char *text, char delimiter, int *count);Used in text_words_alignment, text_strings_management.
Append text at specific position and move cursor
Append text at specific position and move cursor. `text` must have room (C semantics, unchecked).
Zigfn textAppend(text: [*]u8, append: [:0]const u8, position: *i32) voidCvoid TextAppend(char *text, const char *append, int *position);Find first text occurrence within a string, -1 if not found
Zigfn textFindIndex(text: [:0]const u8, search: [:0]const u8) i32Cint TextFindIndex(const char *text, const char *search);Used in core_input_gestures_testbed.
Get upper case version of provided string
Zigfn textToUpper(text: [:0]const u8) [:0]const u8Cchar *TextToUpper(const char *text);Used in text_strings_management.
Get lower case version of provided string
Zigfn textToLower(text: [:0]const u8) [:0]const u8Cchar *TextToLower(const char *text);Used in core_input_gamepad, text_strings_management.
Get Pascal case notation version of provided string
Zigfn textToPascal(text: [:0]const u8) [:0]const u8Cchar *TextToPascal(const char *text);Used in text_strings_management.
Get Snake case notation version of provided string
Zigfn textToSnake(text: [:0]const u8) [:0]const u8Cchar *TextToSnake(const char *text);Used in text_strings_management.
Get Camel case notation version of provided string
Zigfn textToCamel(text: [:0]const u8) [:0]const u8Cchar *TextToCamel(const char *text);Used in text_strings_management.
Get integer value from text
Zigfn textToInteger(text: [:0]const u8) i32Cint TextToInteger(const char *text);Get float value from text
Zigfn textToFloat(text: [:0]const u8) f32Cfloat TextToFloat(const char *text);