freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] bytecode_tweaks ba4f3c954 5/5: [truetype/v40] Modify x- and


From: Werner Lemberg
Subject: [freetype2] bytecode_tweaks ba4f3c954 5/5: [truetype/v40] Modify x- and y-movement cancellation.
Date: Sat, 3 May 2025 15:32:23 -0400 (EDT)

branch: bytecode_tweaks
commit ba4f3c9543516a35a9b88cdde23d0b821663dd26
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>

    [truetype/v40] Modify x- and y-movement cancellation.
    
    * src/truetype/ttinterp.c (Compute_Funcs,Ins_IUP): Check interpreter
    and modify the "projected" freedom vector here...
    (Move_Zp2_Point, Direct_Move): ... instead of checking here.
---
 src/truetype/ttinterp.c | 74 ++++++++++++++++---------------------------------
 1 file changed, 24 insertions(+), 50 deletions(-)

diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c
index f30f0657a..7715a8659 100644
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -1644,19 +1644,8 @@
     v = exc->moveVector.x;
     if ( v != 0 )
     {
-#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
-      /* Exception to the post-IUP curfew: Allow the x component of */
-      /* diagonal moves, but only post-IUP.  DejaVu tries to adjust */
-      /* diagonal stems like on `Z' and `z' post-IUP.               */
-      if ( SUBPIXEL_HINTING_MINIMAL && !exc->backward_compatibility )
-        zone->cur[point].x = ADD_LONG( zone->cur[point].x,
-                                       FT_MulFix( distance, v ) );
-      else
-#endif
-
-      if ( NO_SUBPIXEL_HINTING )
-        zone->cur[point].x = ADD_LONG( zone->cur[point].x,
-                                       FT_MulFix( distance, v ) );
+      zone->cur[point].x = ADD_LONG( zone->cur[point].x,
+                                     FT_MulFix( distance, v ) );
 
       zone->tags[point] |= FT_CURVE_TAG_TOUCH_X;
     }
@@ -1664,14 +1653,8 @@
     v = exc->moveVector.y;
     if ( v != 0 )
     {
-#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
-      if ( !( SUBPIXEL_HINTING_MINIMAL    &&
-              exc->backward_compatibility &&
-              exc->iupx_called            &&
-              exc->iupy_called            ) )
-#endif
-        zone->cur[point].y = ADD_LONG( zone->cur[point].y,
-                                       FT_MulFix( distance, v ) );
+      zone->cur[point].y = ADD_LONG( zone->cur[point].y,
+                                     FT_MulFix( distance, v ) );
 
       zone->tags[point] |= FT_CURVE_TAG_TOUCH_Y;
     }
@@ -1708,13 +1691,11 @@
 
 
     v = exc->moveVector.x;
-
     if ( v != 0 )
       zone->org[point].x = ADD_LONG( zone->org[point].x,
                                      FT_MulFix( distance, v ) );
 
     v = exc->moveVector.y;
-
     if ( v != 0 )
       zone->org[point].y = ADD_LONG( zone->org[point].y,
                                      FT_MulFix( distance, v ) );
@@ -1738,14 +1719,9 @@
                  FT_UShort       point,
                  FT_F26Dot6      distance )
   {
-#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
-    if ( SUBPIXEL_HINTING_MINIMAL && !exc->backward_compatibility )
-      zone->cur[point].x = ADD_LONG( zone->cur[point].x, distance );
-    else
-#endif
+    FT_UNUSED( exc );
 
-    if ( NO_SUBPIXEL_HINTING )
-      zone->cur[point].x = ADD_LONG( zone->cur[point].x, distance );
+    zone->cur[point].x = ADD_LONG( zone->cur[point].x, distance );
 
     zone->tags[point]  |= FT_CURVE_TAG_TOUCH_X;
   }
@@ -1759,12 +1735,7 @@
   {
     FT_UNUSED( exc );
 
-#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
-    if ( !( SUBPIXEL_HINTING_MINIMAL             &&
-            exc->backward_compatibility          &&
-            exc->iupx_called && exc->iupy_called ) )
-#endif
-      zone->cur[point].y = ADD_LONG( zone->cur[point].y, distance );
+    zone->cur[point].y = ADD_LONG( zone->cur[point].y, distance );
 
     zone->tags[point] |= FT_CURVE_TAG_TOUCH_Y;
   }
@@ -2460,12 +2431,22 @@
       exc->moveVector.y = ( exc->GS.freeVector.y << 16 ) / F_dot_P;
     }
 
-    if ( F_dot_P >= 0x3FFEL && exc->GS.freeVector.x == 0x4000 )
+#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
+    if ( SUBPIXEL_HINTING_MINIMAL && exc->backward_compatibility )
+    {
+      exc->moveVector.x = 0;
+
+      if ( exc->iupx_called && exc->iupy_called )
+        exc->moveVector.y = 0;
+    }
+#endif
+
+    if ( F_dot_P >= 0x3FFEL && exc->moveVector.x == 0x10000L )
     {
       exc->func_move      = (TT_Move_Func)Direct_Move_X;
       exc->func_move_orig = (TT_Move_Func)Direct_Move_Orig_X;
     }
-    else if ( F_dot_P >= 0x3FFEL && exc->GS.freeVector.y == 0x4000 )
+    else if ( F_dot_P >= 0x3FFEL && exc->moveVector.y == 0x10000L )
     {
       exc->func_move      = (TT_Move_Func)Direct_Move_Y;
       exc->func_move_orig = (TT_Move_Func)Direct_Move_Orig_Y;
@@ -5173,11 +5154,7 @@
   {
     if ( exc->GS.freeVector.x != 0 )
     {
-#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
-      if ( !( SUBPIXEL_HINTING_MINIMAL    &&
-              exc->backward_compatibility ) )
-#endif
-        exc->zp2.cur[point].x = ADD_LONG( exc->zp2.cur[point].x, dx );
+      exc->zp2.cur[point].x = ADD_LONG( exc->zp2.cur[point].x, dx );
 
       if ( touch )
         exc->zp2.tags[point] |= FT_CURVE_TAG_TOUCH_X;
@@ -5185,13 +5162,7 @@
 
     if ( exc->GS.freeVector.y != 0 )
     {
-#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
-      if ( !( SUBPIXEL_HINTING_MINIMAL    &&
-              exc->backward_compatibility &&
-              exc->iupx_called            &&
-              exc->iupy_called            ) )
-#endif
-        exc->zp2.cur[point].y = ADD_LONG( exc->zp2.cur[point].y, dy );
+      exc->zp2.cur[point].y = ADD_LONG( exc->zp2.cur[point].y, dy );
 
       if ( touch )
         exc->zp2.tags[point] |= FT_CURVE_TAG_TOUCH_Y;
@@ -6413,6 +6384,9 @@
         exc->iupx_called = TRUE;
       else
         exc->iupy_called = TRUE;
+
+      if ( exc->iupx_called && exc->iupy_called )
+        exc->moveVector.y = 0;
     }
 #endif
 



reply via email to

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