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.
This commit is contained in:
Ray
2022-09-22 20:35:55 +02:00
parent 4b1d4b4f6b
commit 810a0330ab
3 changed files with 151 additions and 87 deletions

View File

@@ -1238,8 +1238,8 @@ Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Co
{
// Get next codepoint from byte string and glyph index in font
int codepointByteCount = 0;
int codepoint = GetCodepoint(&text[i], &codepointByteCount); // WARNING: Module required: rtext
int index = GetGlyphIndex(font, codepoint); // WARNING: Module required: rtext
int codepoint = GetCodepointNext(&text[i], &codepointByteCount); // WARNING: Module required: rtext
int index = GetGlyphIndex(font, codepoint); // WARNING: Module required: rtext
// NOTE: Normally we exit the decoding sequence as soon as a bad byte is found (and return 0x3f)
// but we need to draw all of the bad bytes using the '?' symbol moving one byte