From 41dbb06b765acbf44a45f20fc29b232dafac20ca Mon Sep 17 00:00:00 2001 From: Germano Cavalcante Date: Thu, 27 Feb 2020 10:55:07 -0300 Subject: Fix T74228, T74246: Strange Characters The glyph can come from a different cache. --- source/blender/blenfont/intern/blf_glyph.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'source/blender/blenfont/intern/blf_glyph.c') diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c index 8e88bda37a5..3ab6814c531 100644 --- a/source/blender/blenfont/intern/blf_glyph.c +++ b/source/blender/blenfont/intern/blf_glyph.c @@ -461,7 +461,7 @@ void blf_glyph_render(FontBLF *font, GlyphCacheBLF *gc, GlyphBLF *g, float x, fl return; } - if (!g->cached) { + if (g->glyph_cache == NULL) { if (font->tex_size_max == -1) { font->tex_size_max = GPU_max_texture_size(); } @@ -492,7 +492,7 @@ void blf_glyph_render(FontBLF *font, GlyphCacheBLF *gc, GlyphBLF *g, float x, fl gc->bitmap_len = bitmap_len; gc->glyphs_len_free--; - g->cached = true; + g->glyph_cache = gc; } if (font->flags & BLF_CLIPPING) { @@ -505,8 +505,10 @@ void blf_glyph_render(FontBLF *font, GlyphCacheBLF *gc, GlyphBLF *g, float x, fl } } - g_batch.glyph_cache = gc; - BLI_assert(g->offset < gc->bitmap_len); + if (g_batch.glyph_cache != g->glyph_cache) { + blf_batch_draw(); + g_batch.glyph_cache = g->glyph_cache; + } if (font->flags & BLF_SHADOW) { rctf rect_ofs; -- cgit v1.2.3