freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] master d44daf9: * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyp


From: Werner LEMBERG
Subject: [freetype2] master d44daf9: * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Thinko.
Date: Wed, 21 Dec 2016 22:04:14 +0000 (UTC)

branch: master
commit d44daf9e9b3b3f14f3e813a9aaa6dc6ce375c4d4
Author: Werner Lemberg <address@hidden>
Commit: Werner Lemberg <address@hidden>

    * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Thinko.
    
    Don't apply deltas twice for non-phantom points.
    
    Spotted by Ben Wagner.
---
 ChangeLog              |    8 ++++++++
 src/autofit/afglobal.c |   13 ++-----------
 src/base/ftmm.c        |   28 ++++++++++++++++++++++++++++
 src/truetype/ttgxvar.c |   42 ++++++++++++++++++++++++++++--------------
 4 files changed, 66 insertions(+), 25 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8b71086..8496616 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2016-12-21  Werner Lemberg  <address@hidden>
 
+       * 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  <address@hidden>
+
        [cff, truetype] Another try for #49829.
 
        * src/cff/cffdrivr.c: Don't include
diff --git a/src/autofit/afglobal.c b/src/autofit/afglobal.c
index ac6dcaf..db070e7 100644
--- 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 );
     }
   }
diff --git a/src/base/ftmm.c b/src/base/ftmm.c
index c352803..1b724ac 100644
--- 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;
   }
 
@@ -255,6 +276,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;
   }
 
diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c
index 3b73283..5a74ae7 100644
--- 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 ) )
-            outline->points[j].x += delta_x;
-          if ( j != ( n_points - 2 )                               ||
-               !( face->variation_support & TT_FACE_FLAG_VAR_LSB ) )
+          if ( j < n_points - 3 )
+          {
             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 )



reply via email to

[Prev in Thread] Current Thread [Next in Thread]