Prevent rendering of unimplemented characters

This commit is contained in:
MysterD 2022-01-28 00:00:25 -08:00
parent 5d9ad46730
commit 32ceded772

View file

@ -37,6 +37,8 @@ static const Gfx djui_font_normal_text_settings[] = {
static void djui_font_normal_render_char(char c) {
extern const u8* const font_normal_chars[];
// replace undisplayable characters
if (c < ' ' || (u8)c > ('~' + 1)) { c = '?'; }
void* fontChar = (void*)font_normal_chars[c - '!'];
if (fontChar == NULL) { fontChar = (void*)font_normal_chars[94]; }
@ -68,6 +70,8 @@ static const struct DjuiFont sDjuiFontNormal = {
static void djui_font_title_render_char(char c) {
extern const u8* const font_title_chars[];
// replace undisplayable characters
if (c < ' ' || (u8)c > ('~' + 1)) { c = '?'; }
djui_gfx_render_texture(font_title_chars[c - '!'], 64, 64, 32);
}