Closed zxchris closed 7 years ago
Simpler solution, just use the strlen of codepoints. No second variable needed.
for( i = 0; i < strlen(codepoints); i += utf8_surrogate_len(codepoints + i) ) {
@zxchris Does the @forthy42 solution works for you ?
Yes works fine, it's effectively the same thing, but counting bytes not glyphs. And it's arguably more efficient too, not doing the glyph count up front.
texture_font_load_glyphs()
is incorrectly processing the passed incodepoints
list. It increments the index offset by each codepoint length correctly, but is using that bytecount as a codepoint count.Thus it stops processing when it has read
utf8_strlen(codepoints)
bytes, notutf8_strlen(codepoints)
glyphs. So if your codepoint list had 147 codepoints, only 147 bytes were being consumed.