shithub: freetype+ttf2subf

Download patch

ref: d44daf9e9b3b3f14f3e813a9aaa6dc6ce375c4d4
parent: e6a429e2c7c3126d3ff46b6d69bd21d645ecccd5
author: Werner Lemberg <[email protected]>
date: Wed Dec 21 18:03:48 EST 2016

* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Thinko.

Don't apply deltas twice for non-phantom points.

Spotted by Ben Wagner.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2016-12-21  Werner Lemberg  <[email protected]>
 
+	* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Thinko.
+
+	Don't apply deltas twice for non-phantom points.
+
+	Spotted by Ben Wagner.
+
+2016-12-21  Werner Lemberg  <[email protected]>
+
 	[cff, truetype] Another try for #49829.
 
 	* src/cff/cffdrivr.c: Don't include
--- a/src/autofit/afglobal.c
+++ b/src/autofit/afglobal.c
@@ -417,17 +417,8 @@
       globals->hb_buf = NULL;
 #endif
 
-      globals->glyph_count               = 0;
-      globals->stem_darkening_for_ppem   = 0;
-      globals->darken_x                  = 0;
-      globals->darken_y                  = 0;
-      globals->standard_vertical_width   = 0;
-      globals->standard_horizontal_width = 0;
-      globals->scale_down_factor         = 0;
-      /* no need to free this one! */
-      globals->glyph_styles              = NULL;
-      globals->face                      = NULL;
-
+      /* no need to free `globals->glyph_styles'; */
+      /* it is part of the `globals' array        */
       FT_FREE( globals );
     }
   }
--- a/src/base/ftmm.c
+++ b/src/base/ftmm.c
@@ -140,6 +140,13 @@
         error = service->set_mm_design( face, num_coords, coords );
     }
 
+    /* enforce recomputation of auto-hinting data */
+    if ( !error && face->autohint.finalizer )
+    {
+      face->autohint.finalizer( face->autohint.data );
+      face->autohint.data = NULL;
+    }
+
     return error;
   }
 
@@ -168,6 +175,13 @@
         error = service->set_var_design( face, num_coords, coords );
     }
 
+    /* enforce recomputation of auto-hinting data */
+    if ( !error && face->autohint.finalizer )
+    {
+      face->autohint.finalizer( face->autohint.data );
+      face->autohint.data = NULL;
+    }
+
     return error;
   }
 
@@ -224,6 +238,13 @@
         error = service->set_mm_blend( face, num_coords, coords );
     }
 
+    /* enforce recomputation of auto-hinting data */
+    if ( !error && face->autohint.finalizer )
+    {
+      face->autohint.finalizer( face->autohint.data );
+      face->autohint.data = NULL;
+    }
+
     return error;
   }
 
@@ -253,6 +274,13 @@
       error = FT_ERR( Invalid_Argument );
       if ( service->set_mm_blend )
         error = service->set_mm_blend( face, num_coords, coords );
+    }
+
+    /* enforce recomputation of auto-hinting data */
+    if ( !error && face->autohint.finalizer )
+    {
+      face->autohint.finalizer( face->autohint.data );
+      face->autohint.data = NULL;
     }
 
     return error;
--- a/src/truetype/ttgxvar.c
+++ b/src/truetype/ttgxvar.c
@@ -2616,22 +2616,36 @@
           FT_Pos  delta_y = FT_MulFix( deltas_y[j], apply );
 
 
-          /* To avoid double adjustment of advance width or height, */
-          /* adjust phantom points only if there is no HVAR or VVAR */
-          /* table, respectively.                                   */
-          if ( j != ( n_points - 3 )                                    ||
-               !( face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) )
+          if ( j < n_points - 3 )
+          {
             outline->points[j].x += delta_x;
-          if ( j != ( n_points - 2 )                               ||
-               !( face->variation_support & TT_FACE_FLAG_VAR_LSB ) )
-            outline->points[j].x += delta_x;
-
-          if ( j != ( n_points - 1 )                                    ||
-               !( face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) )
             outline->points[j].y += delta_y;
-          if ( j != ( n_points - 0 )                               ||
-               !( face->variation_support & TT_FACE_FLAG_VAR_TSB ) )
-            outline->points[j].y += delta_y;
+          }
+          else
+          {
+            /* To avoid double adjustment of advance width or height, */
+            /* adjust phantom points only if there is no HVAR or VVAR */
+            /* support, respectively.                                 */
+            if ( j == ( n_points - 3 )          ||
+                 !( face->variation_support   &
+                    TT_FACE_FLAG_VAR_HADVANCE ) )
+              outline->points[j].x += delta_x;
+
+            else if ( j == ( n_points - 2 )        ||
+                      !( face->variation_support &
+                         TT_FACE_FLAG_VAR_LSB    ) )
+              outline->points[j].x += delta_x;
+
+            else if ( j == ( n_points - 1 )          ||
+                      !( face->variation_support   &
+                         TT_FACE_FLAG_VAR_VADVANCE ) )
+              outline->points[j].y += delta_y;
+
+            else if ( j == ( n_points - 0 )        ||
+                      !( face->variation_support &
+                         TT_FACE_FLAG_VAR_TSB    ) )
+              outline->points[j].y += delta_y;
+          }
 
 #ifdef FT_DEBUG_LEVEL_TRACE
           if ( delta_x || delta_y )