diff options
Diffstat (limited to 'source/blender/blenfont/intern/blf_thumbs.c')
-rw-r--r-- | source/blender/blenfont/intern/blf_thumbs.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/source/blender/blenfont/intern/blf_thumbs.c b/source/blender/blenfont/intern/blf_thumbs.c index 37eed29f6fe..6aa39e3aa71 100644 --- a/source/blender/blenfont/intern/blf_thumbs.c +++ b/source/blender/blenfont/intern/blf_thumbs.c @@ -66,6 +66,7 @@ void BLF_thumb_preview(const char *filename, int font_shrink = 4; FontBLF *font; + GlyphCacheBLF *gc; int i; /* Create a new blender font obj and fill it with default values */ @@ -96,9 +97,9 @@ void BLF_thumb_preview(const char *filename, int draw_str_i18n_nbr = 0; blf_font_size(font, (unsigned int)MAX2(font_size_min, font_size_curr), dpi); - - /* font->glyph_cache remains NULL if blf_font_size() failed to set font size */ - if (!font->glyph_cache) { + gc = blf_glyph_cache_find(font, font->size, font->dpi); + /* There will be no matching glyph cache if blf_font_size() failed to set font size. */ + if (!gc) { break; } @@ -106,7 +107,7 @@ void BLF_thumb_preview(const char *filename, font_size_curr -= (font_size_curr / font_shrink); font_shrink += 1; - font->pos[1] -= font->glyph_cache->ascender * 1.1f; + font->pos[1] -= gc->ascender * 1.1f; /* We fallback to default english strings in case not enough chars are available in current * font for given translated string (useful in non-latin i18n context, like Chinese, |