diff --git a/gfx/drivers_font_renderer/bitmapfont.c b/gfx/drivers_font_renderer/bitmapfont.c index 97f8dce095..f8a404149d 100644 --- a/gfx/drivers_font_renderer/bitmapfont.c +++ b/gfx/drivers_font_renderer/bitmapfont.c @@ -76,6 +76,7 @@ static void char_to_texture(bm_renderer_t *handle, uint8_t letter, dst[xo + yo * handle->atlas.width] = col; } } + handle->atlas.dirty = true; } static void *font_renderer_bmp_init(const char *font_path, float font_size) diff --git a/gfx/drivers_font_renderer/stb.c b/gfx/drivers_font_renderer/stb.c index f0cdf7952f..5ddc0795df 100644 --- a/gfx/drivers_font_renderer/stb.c +++ b/gfx/drivers_font_renderer/stb.c @@ -38,7 +38,7 @@ typedef struct struct font_glyph glyphs[256]; } stb_font_renderer_t; -static const struct font_atlas *font_renderer_stb_get_atlas(void *data) +static struct font_atlas *font_renderer_stb_get_atlas(void *data) { stb_font_renderer_t *self = (stb_font_renderer_t*)data; return &self->atlas; @@ -89,6 +89,8 @@ static bool font_renderer_stb_create_atlas(stb_font_renderer_t *self, stbtt_PackFontRange(&pc, font_data, 0, font_size, 0, 256, chardata); stbtt_PackEnd(&pc); + self->atlas.dirty = true; + for (i = 0; i < 256; ++i) { struct font_glyph *g = &self->glyphs[i]; diff --git a/gfx/font_driver.h b/gfx/font_driver.h index 988c65e548..2b2044b695 100644 --- a/gfx/font_driver.h +++ b/gfx/font_driver.h @@ -73,6 +73,7 @@ struct font_atlas uint8_t *buffer; /* Alpha channel. */ unsigned width; unsigned height; + bool dirty; }; struct font_params @@ -112,7 +113,7 @@ typedef struct font_renderer_driver { void *(*init)(const char *font_path, float font_size); - const struct font_atlas *(*get_atlas)(void *data); + struct font_atlas *(*get_atlas)(void *data); /* Returns NULL if no glyph for this code is found. */ const struct font_glyph *(*get_glyph)(void *data, uint32_t code);