diff options
author | pommicket <pommicket@gmail.com> | 2021-10-02 16:47:02 -0400 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2021-10-02 16:47:02 -0400 |
commit | b6657c312abcddee73c1f79d55d8d4fd597d19aa (patch) | |
tree | 2f565fad7f5aee6852a9ca691a62c8d58bebf673 | |
parent | 10c845e25cfc18694faf297d5f2c21671d72a2f7 (diff) |
fix vlib text rendering for codepoints outside of ASCII
im not actually supporting them but at least now it wont break anything
-rw-r--r-- | vlib.h | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -12540,6 +12540,13 @@ V_DECL void gl_text_set(GLText *text, const char *str) { float x = 0, y = 0; for (i = 0; i < len; ++i) { char c = str[i]; + unsigned char uc = (unsigned char)c; + if (uc > static_arr_len(text_positions)) { + if (unicode_is_start_of_code_point(uc)) + c = '?'; // one question mark per non-ASCII UTF-8 codepoint + else + continue; + } if (c == '\n') { x = 0; y -= 1; |