freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master a35b081 1/2: [truetype] Limit INSTCTRL appication wit


From: Werner Lemberg
Subject: [freetype2] master a35b081 1/2: [truetype] Limit INSTCTRL appication within specs.
Date: Sat, 11 Dec 2021 22:30:39 -0500 (EST)

branch: master
commit a35b081ebc16e1bf79fe29ec9ecbb369019ed04e
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>

    [truetype] Limit INSTCTRL appication within specs.
    
    * src/truetype/ttinterp.c (Ins_INSTCTRL): Limit its global effects
    to the CVT program and local effects to the glyph program.
    
    This also fixes an Infinality buglet. The `ignore_x_mode` should be
    locally unset by the glyph program.
---
 src/truetype/ttinterp.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c
index 731095e..d1a4bca 100644
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -5260,16 +5260,21 @@
       }
     }
 
-    exc->GS.instruct_control &= ~(FT_Byte)Kf;
-    exc->GS.instruct_control |= (FT_Byte)L;
+    /* INSTCTRL should only be used in the CVT program */
+    if ( exc->iniRange == tt_coderange_cvt )
+    {
+      exc->GS.instruct_control &= ~(FT_Byte)Kf;
+      exc->GS.instruct_control |= (FT_Byte)L;
+    }
 
-    if ( K == 3 )
+    /* except to change the subpixel flags temporarily */
+    else if ( exc->iniRange == tt_coderange_glyph && K == 3 )
     {
 #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
       /* INSTCTRL modifying flag 3 also has an effect */
       /* outside of the CVT program                   */
       if ( SUBPIXEL_HINTING_INFINALITY )
-        exc->ignore_x_mode = FT_BOOL( L == 4 );
+        exc->ignore_x_mode = !FT_BOOL( L == 4 );
 #endif
 
 #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
@@ -5280,6 +5285,8 @@
         exc->backward_compatibility = !FT_BOOL( L == 4 );
 #endif
     }
+    else if ( exc->pedantic_hinting )
+      exc->error = FT_THROW( Invalid_Reference );
   }
 
 



reply via email to

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