Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenfont/intern/blf_font.c')
-rw-r--r--source/blender/blenfont/intern/blf_font.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index 3e17b26bc6c..b510832cbdd 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -135,6 +135,17 @@ void blf_font_draw(FontBLF *font, char *str)
if (!g)
continue;
+ /*
+ * This happen if we change the mode of the
+ * font, we don't drop the glyph cache, so it's
+ * possible that some glyph don't have the
+ * bitmap or texture information.
+ */
+ if (font->mode == BLF_MODE_BITMAP && (!g->bitmap_data))
+ g= blf_glyph_add(font, glyph_index, c);
+ else if (font->mode == BLF_MODE_TEXTURE && (!g->tex_data))
+ g= blf_glyph_add(font, glyph_index, c);
+
if (has_kerning && g_prev) {
delta.x= 0;
delta.y= 0;
@@ -194,6 +205,17 @@ void blf_font_boundbox(FontBLF *font, char *str, rctf *box)
if (!g)
continue;
+ /*
+ * This happen if we change the mode of the
+ * font, we don't drop the glyph cache, so it's
+ * possible that some glyph don't have the
+ * bitmap or texture information.
+ */
+ if (font->mode == BLF_MODE_BITMAP && (!g->bitmap_data))
+ g= blf_glyph_add(font, glyph_index, c);
+ else if (font->mode == BLF_MODE_TEXTURE && (!g->tex_data))
+ g= blf_glyph_add(font, glyph_index, c);
+
if (has_kerning && g_prev) {
delta.x= 0;
delta.y= 0;