From 60e53e0ce68a1823b3a20b007181f23b2c5c7453 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 19 Feb 2016 09:40:26 +1100 Subject: Fix crash drawing fonts at size 1 --- source/blender/blenfont/intern/blf_glyph.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source/blender/blenfont') diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c index 1c13e42f70d..41726e41176 100644 --- a/source/blender/blenfont/intern/blf_glyph.c +++ b/source/blender/blenfont/intern/blf_glyph.c @@ -113,6 +113,10 @@ GlyphCacheBLF *blf_glyph_cache_new(FontBLF *font) gc->max_glyph_height = (int)(((float)font->face->size->metrics.height) / 64.0f); } + /* can happen with size 1 fonts */ + CLAMP_MIN(gc->max_glyph_width, 1); + CLAMP_MIN(gc->max_glyph_height, 1); + gc->p2_width = 0; gc->p2_height = 0; -- cgit v1.2.3