summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2021-10-02 16:47:02 -0400
committerpommicket <pommicket@gmail.com>2021-10-02 16:47:02 -0400
commitb6657c312abcddee73c1f79d55d8d4fd597d19aa (patch)
tree2f565fad7f5aee6852a9ca691a62c8d58bebf673
parent10c845e25cfc18694faf297d5f2c21671d72a2f7 (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.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/vlib.h b/vlib.h
index 5140b83..b081806 100644
--- a/vlib.h
+++ b/vlib.h
@@ -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;