From b6657c312abcddee73c1f79d55d8d4fd597d19aa Mon Sep 17 00:00:00 2001 From: pommicket Date: Sat, 2 Oct 2021 16:47:02 -0400 Subject: fix vlib text rendering for codepoints outside of ASCII im not actually supporting them but at least now it wont break anything --- vlib.h | 7 +++++++ 1 file changed, 7 insertions(+) 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; -- cgit v1.2.3