[Bf-blender-cvs] [60e53e0] master: Fix crash drawing fonts at size 1

Campbell Barton noreply at git.blender.org
Thu Feb 18 23:48:59 CET 2016


Commit: 60e53e0ce68a1823b3a20b007181f23b2c5c7453
Author: Campbell Barton
Date:   Fri Feb 19 09:40:26 2016 +1100
Branches: master
https://developer.blender.org/rB60e53e0ce68a1823b3a20b007181f23b2c5c7453

Fix crash drawing fonts at size 1

===================================================================

M	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 1c13e42..41726e4 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;




More information about the Bf-blender-cvs mailing list