freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] clean-gxvar a94b275cf 1/2: [truetype/GX] Clean up phantom po


From: Werner Lemberg
Subject: [freetype2] clean-gxvar a94b275cf 1/2: [truetype/GX] Clean up phantom point adjustment.
Date: Fri, 17 Jun 2022 13:46:19 -0400 (EDT)

branch: clean-gxvar
commit a94b275cf1ad590d81c5fc433df5d6ec98208dfc
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>

    [truetype/GX] Clean up phantom point adjustment.
    
    * src/truetype/ttgload.c (load_truetype_glyph): Move it from here...
    * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): ... to here
    and check for HVAR and VVAR outside the loop.
---
 src/truetype/ttgload.c | 20 --------------------
 src/truetype/ttgxvar.c | 47 +++++++++++++++--------------------------------
 2 files changed, 15 insertions(+), 52 deletions(-)

diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index e4b4fe526..d2f7496a1 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -1778,16 +1778,6 @@
                                             (FT_UInt)outline.n_points );
         if ( error )
           goto Exit;
-
-        loader->pp1.x = points[0].x;
-        loader->pp1.y = points[0].y;
-        loader->pp2.x = points[1].x;
-        loader->pp2.y = points[1].y;
-
-        loader->pp3.x = points[2].x;
-        loader->pp3.y = points[2].y;
-        loader->pp4.x = points[3].x;
-        loader->pp4.y = points[3].y;
       }
 
 #endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */
@@ -2008,16 +1998,6 @@
           }
         }
 
-        loader->pp1.x = points[i + 0].x;
-        loader->pp1.y = points[i + 0].y;
-        loader->pp2.x = points[i + 1].x;
-        loader->pp2.y = points[i + 1].y;
-
-        loader->pp3.x = points[i + 2].x;
-        loader->pp3.y = points[i + 2].y;
-        loader->pp4.x = points[i + 3].x;
-        loader->pp4.y = points[i + 3].y;
-
       Exit1:
         FT_FREE( outline.points );
         FT_FREE( outline.tags );
diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c
index e81f3faeb..8f8239f15 100644
--- a/src/truetype/ttgxvar.c
+++ b/src/truetype/ttgxvar.c
@@ -4177,36 +4177,8 @@
           FT_Pos  point_delta_y = points_out[j].y - points_org[j].y;
 
 
-          if ( j < n_points - 4 )
-          {
-            point_deltas_x[j] = old_point_delta_x + point_delta_x;
-            point_deltas_y[j] = old_point_delta_y + point_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 - 4 )        &&
-                 !( face->variation_support &
-                    TT_FACE_FLAG_VAR_LSB    ) )
-              point_deltas_x[j] = old_point_delta_x + point_delta_x;
-
-            else if ( j == ( n_points - 3 )          &&
-                      !( face->variation_support   &
-                         TT_FACE_FLAG_VAR_HADVANCE ) )
-              point_deltas_x[j] = old_point_delta_x + point_delta_x;
-
-            else if ( j == ( n_points - 2 )        &&
-                      !( face->variation_support &
-                         TT_FACE_FLAG_VAR_TSB    ) )
-              point_deltas_y[j] = old_point_delta_y + point_delta_y;
-
-            else if ( j == ( n_points - 1 )          &&
-                      !( face->variation_support   &
-                         TT_FACE_FLAG_VAR_VADVANCE ) )
-              point_deltas_y[j] = old_point_delta_y + point_delta_y;
-          }
+          point_deltas_x[j] = old_point_delta_x + point_delta_x;
+          point_deltas_y[j] = old_point_delta_y + point_delta_y;
 
 #ifdef FT_DEBUG_LEVEL_TRACE
           if ( point_delta_x || point_delta_y )
@@ -4253,14 +4225,25 @@
       outline->points[i].y += FT_fixedToInt( point_deltas_y[i] );
     }
 
-    /* recalculate linear horizontal and vertical advances */
-    /* if we don't have HVAR and VVAR, respectively        */
+    /* To avoid double adjustment of advance width or height, */
+    /* adjust phantom points only if there is no HVAR or VVAR */
+    /* support, respectively.                                 */
+    if ( !( face->variation_support & TT_FACE_FLAG_VAR_LSB ) )
+      loader->pp1      = outline->points[n_points - 4];
     if ( !( face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) )
+    {
+      loader->pp2      = outline->points[n_points - 3];
       loader->linear   = FT_PIX_ROUND( unrounded[n_points - 3].x -
                                        unrounded[n_points - 4].x ) / 64;
+    }
+    if ( !( face->variation_support & TT_FACE_FLAG_VAR_TSB ) )
+      loader->pp3      = outline->points[n_points - 2];
     if ( !( face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) )
+    {
+      loader->pp4      = outline->points[n_points - 1];
       loader->vadvance = FT_PIX_ROUND( unrounded[n_points - 1].y -
                                        unrounded[n_points - 2].y ) / 64;
+    }
 
   Fail3:
     FT_FREE( point_deltas_x );



reply via email to

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