shithub: freetype+ttf2subf

Download patch

ref: 03987bfdbf43a86c59702fdafe98c95cce1b208a
parent: 7e83f06804c3c4d9c740c857b913595939490e80
author: Werner Lemberg <[email protected]>
date: Thu Oct 16 03:19:46 EDT 2014

A better fix for Savannah bug #43392.
Suggested by Doug Felt <[email protected]>.

* src/sfnt/ttsbit.c (tt_sbit_decoder_load_metrics): Set
`vertAdvance' to zero...

* src/truetype/ttgload.c (TT_Load_Glyph): ... and set here a default
value for `vertAdvance' based on `linearVertAdvance' in case
`vertAdvance' is zero.  Note that the previous computed ad-hoc value
for `linearVertAdvance' was apparently not tested in a real-life
situation.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,20 @@
 	out of range.
 	(Ins_DELTAP, Ins_DELTAC): Optimize for legal delta_shift.
 
+2014-10-16  Werner Lemberg  <[email protected]>
+
+	A better fix for Savannah bug #43392.
+	Suggested by Doug Felt <[email protected]>.
+
+	* src/sfnt/ttsbit.c (tt_sbit_decoder_load_metrics): Set 
+	`vertAdvance' to zero...
+
+	* src/truetype/ttgload.c (TT_Load_Glyph): ... and set here a default
+	value for `vertAdvance' based on `linearVertAdvance' in case
+	`vertAdvance' is zero.  Note that the previous computed ad-hoc value
+	for `linearVertAdvance' was apparently not tested in a real-life
+	situation.
+
 2014-10-14  David Weiß  <[email protected]>
 
 	[build] Better optimization settings for vc2010 solution file.
--- a/src/sfnt/ttsbit.c
+++ b/src/sfnt/ttsbit.c
@@ -510,7 +510,7 @@
       /* avoid uninitialized data in case there is no vertical info -- */
       metrics->vertBearingX = 0;
       metrics->vertBearingY = 0;
-      metrics->vertAdvance  = metrics->width;
+      metrics->vertAdvance  = 0;
     }
 
     decoder->metrics_loaded = 1;
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -2373,15 +2373,18 @@
           (void)tt_loader_init( &loader, size, glyph, load_flags, TRUE );
           (void)load_truetype_glyph( &loader, glyph_index, 0, TRUE );
           glyph->linearHoriAdvance = loader.linear;
-          glyph->linearVertAdvance = loader.top_bearing + loader.bbox.yMax -
-                                       loader.vadvance;
+          glyph->linearVertAdvance = loader.vadvance;
 
-          /* sanity check: if `horiAdvance' in the sbit metric */
-          /* structure isn't set, use `linearHoriAdvance'      */
+          /* sanity checks: if `xxxAdvance' in the sbit metric */
+          /* structure isn't set, use `linearXXXAdvance'      */
           if ( !glyph->metrics.horiAdvance && glyph->linearHoriAdvance )
             glyph->metrics.horiAdvance =
               FT_MulFix( glyph->linearHoriAdvance,
                          size->root.metrics.x_scale );
+          if ( !glyph->metrics.vertAdvance && glyph->linearVertAdvance )
+            glyph->metrics.vertAdvance =
+              FT_MulFix( glyph->linearVertAdvance,
+                         size->root.metrics.y_scale );
         }
 
         return FT_Err_Ok;