From cb679636f77fe2a03e8dab3a511e28e1ab898316 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 6 Nov 2021 15:55:42 +0100 Subject: Fix exit being called when closing window, respond to wm ping, add is_open function to window --- src/graphics/font.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/graphics/font.c') diff --git a/src/graphics/font.c b/src/graphics/font.c index c017755..175c571 100644 --- a/src/graphics/font.c +++ b/src/graphics/font.c @@ -84,6 +84,11 @@ int mgl_font_load_from_file(mgl_font *self, const char *filepath, unsigned int c continue; } + /*if(!stbtt_PackFontRange(&pc, filedata.data, 0, self->character_size, 0x00004E00, self->num_packed_chars, self->packed_chars)) { + stbtt_PackEnd(&pc); + continue; + }*/ + stbtt_PackEnd(&pc); atlas_created = true; break; @@ -124,7 +129,7 @@ void mgl_font_unload(mgl_font *self) { int mgl_font_get_glyph(const mgl_font *self, uint32_t codepoint, mgl_font_glyph *glyph) { stbtt_packedchar *packed_chars = self->packed_chars; - if(codepoint >= self->num_packed_chars) + if(codepoint < 0 || codepoint >= 0 + self->num_packed_chars) return -1; float x = 0.0f; -- cgit v1.2.3