freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] bytecode_tweaks 4ea5c6231 6/7: [truetype] Modify movement su


From: Werner Lemberg
Subject: [freetype2] bytecode_tweaks 4ea5c6231 6/7: [truetype] Modify movement suppression in v40.
Date: Thu, 8 May 2025 20:01:41 -0400 (EDT)

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

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

diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c
index 8e10835c0..4c6b0539d 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,23 @@
       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
+    /* This effectively suppresses certain point movements! */
+    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;
@@ -5172,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;
@@ -5184,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;
@@ -6411,6 +6383,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]