From 4c89dfe8890b6e1db40171465246cf5eeac56526 Mon Sep 17 00:00:00 2001 From: Mikhail Ilyin Date: Sun, 22 Dec 2024 20:22:04 +0300 Subject: [PATCH] Added two functions to automatically get number of all available codepoints of font file and update the array of codepoints themselves Added two new functions to get the number of all available codepoints of a font file (or font data in memory) and update the array of codepoints themselves, passed via an argument. By default, the LoadFontEx() or LoadFontFromMemory() functions do not have this feature and load only 95 code points when specifying "NULL, 0" in the arguments. But if the user wants to automatically collect all possible code points of a font and their number, he can use these functions. Having collected them with these functions, he will only have to pass them to the LoadFontEx() or LoadFontFromMemory() functions. --- src/raylib.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/raylib.h b/src/raylib.h index 7e1a1f838..133fb9d54 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -1463,6 +1463,8 @@ RLAPI int GetPixelDataSize(int width, int height, int format); // G // Font loading/unloading functions RLAPI Font GetFontDefault(void); // Get the default Font +RLAPI int GetFontAvailableCodepoints(const char *fileName, int **codepoints); // Get number of available codepoints of font file and update the array of codepoints themselves +RLAPI int GetFontAvailableCodepointsFromMemory(const char *fileType, const unsigned char *fileData, int dataSize, int **codepoints); // Get number of available codepoints of font data and update the array of codepoints themselves RLAPI Font LoadFont(const char *fileName); // Load font from file into GPU memory (VRAM) RLAPI Font LoadFontEx(const char *fileName, int fontSize, int *codepoints, int codepointCount); // Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character set, font size is provided in pixels height RLAPI Font LoadFontFromImage(Image image, Color key, int firstChar); // Load font from Image (XNA style)