diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/mgl/graphics/font.h | 2 | ||||
-rw-r--r-- | include/mgl/system/utf8.h | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/include/mgl/graphics/font.h b/include/mgl/graphics/font.h index adcc8a7..6b7eb34 100644 --- a/include/mgl/graphics/font.h +++ b/include/mgl/graphics/font.h @@ -25,7 +25,7 @@ typedef struct { } mgl_font_atlas; struct mgl_font { - mgl_texture texture; + mgl_texture texture; /* Font texture coordinates are in pixel space */ mgl_font_atlas font_atlas; unsigned int character_size; mgl_font_char_map char_map; diff --git a/include/mgl/system/utf8.h b/include/mgl/system/utf8.h index 7120f1a..794884d 100644 --- a/include/mgl/system/utf8.h +++ b/include/mgl/system/utf8.h @@ -9,6 +9,13 @@ Returns false on failure. |decoded_codepoint| is set to |str[0]| if size > 0 and |codepoint_length| is set to 1 */ bool mgl_utf8_decode(const unsigned char *str, size_t size, uint32_t *decoded_codepoint, size_t *codepoint_length); +/* + |str| should be the start of the utf8 string and |size| is the size of the string. + Returns the index of the start of the codepoint that starts at or before |offset|, + or if the string contains invalid utf8 then the index to the invalid character is returned. + Returns 0 if start of codepoint is not found. +*/ +size_t mgl_utf8_get_start_of_codepoint(const unsigned char *str, size_t size, size_t offset); #endif /* MGL_UTF8_H */ |