Skip to content

Commit

Permalink
draw block symbol if the text is not found (fixes crash)
Browse files Browse the repository at this point in the history
  • Loading branch information
ColleagueRiley committed Dec 17, 2023
1 parent 265b54a commit 1632ab8
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions RFont.h
Original file line number Diff line number Diff line change
Expand Up @@ -531,9 +531,6 @@ RFont_glyph RFont_font_add_char(RFont_font* font, char ch, size_t size) {

glyph->src = stbtt_FindGlyphIndex(&font->info, codepoint);

if (glyph->src == 0)
return (RFont_glyph){0, 0};

i32 x0, y0, x1, y1, w, h;
if (stbtt_GetGlyphBox(&font->info, glyph->src, &x0, &y0, &x1, &y1) == 0)
return (RFont_glyph){0, 0};
Expand Down Expand Up @@ -639,7 +636,7 @@ void RFont_draw_text_len(RFont_font* font, const char* text, size_t len, float x
continue;
}

RFont_glyph glyph = RFont_font_add_char(font, *str, size);
RFont_glyph glyph = RFont_font_add_char(font, *str, size);

if (glyph.codepoint == 0 && glyph.size == 0)
continue;
Expand Down Expand Up @@ -704,7 +701,7 @@ void RFont_draw_text_len(RFont_font* font, const char* text, size_t len, float x

x += glyph.advance + spacing;
}

#ifndef RFONT_NO_GRAPHICS
RFont_render_text(font->atlas, verts, tcoords, i / 2);
#endif
Expand Down

0 comments on commit 1632ab8

Please sign in to comment.