Fix T74228, T74246: Strange Characters

The glyph can come from a different cache.
This commit is contained in:
Germano Cavalcante
2020-02-27 10:55:07 -03:00
parent 0a3b4d4c64
commit 41dbb06b76
2 changed files with 7 additions and 5 deletions

View File

@@ -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;

View File

@@ -131,7 +131,7 @@ typedef struct GlyphBLF {
float pos_x;
float pos_y;
bool cached;
struct GlyphCacheBLF *glyph_cache;
} GlyphBLF;
typedef struct FontBufInfoBLF {