[Bf-blender-cvs] [acf083a5bfc] master: BLF: Fix FT_Get_Advance Wrong Value Without Size

Harley Acheson noreply at git.blender.org
Sat Aug 20 02:17:59 CEST 2022


Commit: acf083a5bfc83a38050b1060d4832efc04124bcc
Author: Harley Acheson
Date:   Fri Aug 19 17:16:22 2022 -0700
Branches: master
https://developer.blender.org/rBacf083a5bfc83a38050b1060d4832efc04124bcc

BLF: Fix FT_Get_Advance Wrong Value Without Size

Fix possibility of getting invalid fixed-pitch advance size.

See D15735 for more details.

Differential Revision: https://developer.blender.org/D15735

Own Code.

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

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 6b36844cec8..18f372c666b 100644
--- a/source/blender/blenfont/intern/blf_glyph.c
+++ b/source/blender/blenfont/intern/blf_glyph.c
@@ -96,6 +96,8 @@ static GlyphCacheBLF *blf_glyph_cache_new(FontBLF *font)
   memset(gc->glyph_ascii_table, 0, sizeof(gc->glyph_ascii_table));
   memset(gc->bucket, 0, sizeof(gc->bucket));
 
+  blf_ensure_size(font);
+
   /* Determine ideal fixed-width size for monospaced output. */
   FT_UInt gindex = blf_get_char_index(font, U'0');
   if (gindex && font->face) {
@@ -106,7 +108,6 @@ static GlyphCacheBLF *blf_glyph_cache_new(FontBLF *font)
   }
   else {
     /* Font does not have a face or does not contain "0" so use CSS fallback of 1/2 of em. */
-    blf_ensure_size(font);
     gc->fixed_width = (int)((font->ft_size->metrics.height / 2) >> 6);
   }
   if (gc->fixed_width < 1) {



More information about the Bf-blender-cvs mailing list