summaryrefslogtreecommitdiffhomepage
path: root/src/raylib.h
diff options
context:
space:
mode:
authorRay <[email protected]>2022-09-22 20:35:55 +0200
committerRay <[email protected]>2022-09-22 20:35:55 +0200
commit810a0330abdf13c49843692407e2f77da08f8bdc (patch)
treef772f0a7313522b2f1895e77b8fa058a7cb76969 /src/raylib.h
parent4b1d4b4f6b669b133fab34d9f91ad2f5b898e97a (diff)
downloadraylib-810a0330abdf13c49843692407e2f77da08f8bdc.tar.gz
raylib-810a0330abdf13c49843692407e2f77da08f8bdc.zip
WARNING: Several changes on UTF-8/Codepoints API
- ADDED: `GetCodepointPrevious()` - RENAMED: `GetCodepoint()` -> `GetCodepointNext()`, actually, reimplemented - `GetCodepoint()` has been kept for the moment, for compatibility and also because implementation is different - RENAMED: `TextCodepointsToUTF8()` to `LoadUTF8()`, simpler name and more aligned with raylib conventions (functions loading memory start with Load*()), parameters should be descriptive of functionailty. - ADDED: `UnloadUTF8()`, aligned with `LoadUTF8()` to avoid allocators issues.
Diffstat (limited to 'src/raylib.h')
-rw-r--r--src/raylib.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/raylib.h b/src/raylib.h
index 7e4fdf3f..84a18ebe 100644
--- a/src/raylib.h
+++ b/src/raylib.h
@@ -1370,12 +1370,15 @@ RLAPI GlyphInfo GetGlyphInfo(Font font, int codepoint);
RLAPI Rectangle GetGlyphAtlasRec(Font font, int codepoint); // Get glyph rectangle in font atlas for a codepoint (unicode character), fallback to '?' if not found
// Text codepoints management functions (unicode characters)
-RLAPI int *LoadCodepoints(const char *text, int *count); // Load all codepoints from a UTF-8 text string, codepoints count returned by parameter
-RLAPI void UnloadCodepoints(int *codepoints); // Unload codepoints data from memory
-RLAPI int GetCodepointCount(const char *text); // Get total number of codepoints in a UTF-8 encoded string
-RLAPI int GetCodepoint(const char *text, int *bytesProcessed); // Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure
-RLAPI const char *CodepointToUTF8(int codepoint, int *byteSize); // Encode one codepoint into UTF-8 byte array (array length returned as parameter)
-RLAPI char *TextCodepointsToUTF8(const int *codepoints, int length); // Encode text as codepoints array into UTF-8 text string (WARNING: memory must be freed!)
+RLAPI char *LoadUTF8(const int *codepoints, int length); // Load UTF-8 text encoded from codepoints array
+RLAPI void UnloadUTF8(char *text); // Unload UTF-8 text encoded from codepoints array
+RLAPI int *LoadCodepoints(const char *text, int *count); // Load all codepoints from a UTF-8 text string, codepoints count returned by parameter
+RLAPI void UnloadCodepoints(int *codepoints); // Unload codepoints data from memory
+RLAPI int GetCodepointCount(const char *text); // Get total number of codepoints in a UTF-8 encoded string
+RLAPI int GetCodepoint(const char *text, int *codepointSize); // Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure
+RLAPI int GetCodepointNext(const char *text, int *codepointSize); // Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure
+RLAPI int GetCodepointPrevious(const char *text, int *codepointSize); // Get previous codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure
+RLAPI const char *CodepointToUTF8(int codepoint, int *utf8Size); // Encode one codepoint into UTF-8 byte array (array length returned as parameter)
// Text strings management functions (no UTF-8 strings, only byte chars)
// NOTE: Some strings allocate memory internally for returned strings, just be careful!