freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] ewaldhew-wip 4e6ee95 21/29: [pop] change unknown_othersubr_r


From: Hew Yih Shiuan Ewald
Subject: [freetype2] ewaldhew-wip 4e6ee95 21/29: [pop] change unknown_othersubr_result_cnt behaviour
Date: Mon, 26 Jun 2017 01:55:06 -0400 (EDT)

branch: ewaldhew-wip
commit 4e6ee95952bd7afb3c4fb912f6a8616bce0c1dd1
Author: Ewald Hew <address@hidden>
Commit: Ewald Hew <address@hidden>

    [pop] change unknown_othersubr_result_cnt behaviour
---
 src/psaux/psintrp.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/src/psaux/psintrp.c b/src/psaux/psintrp.c
index 0166f6e..dbd6ef7 100644
--- a/src/psaux/psintrp.c
+++ b/src/psaux/psintrp.c
@@ -491,7 +491,6 @@
 
     /* Stuff for Type 1 */
     FT_Int     known_othersubr_result_cnt   = 0;
-    FT_Int     unknown_othersubr_result_cnt = 0;
     FT_Bool    large_int;
     
     /* save this for hinting seac accents */
@@ -501,7 +500,10 @@
     FT_UInt    stackSize;
     FT_Byte    op1;                       /* first opcode byte */
 
+#define PS_STORAGE_SIZE 3
     CF2_F16Dot16  storage[CF2_STORAGE_SIZE];    /* for `put' and `get' */
+    CF2_F16Dot16  results[PS_STORAGE_SIZE];   /* for othersubr results */
+    FT_Int        result_cnt = 0;
 
     /* instruction limit; 20,000,000 matches Avalon */
     FT_UInt32  instructionLimit = 20000000UL;
@@ -524,6 +526,7 @@
 
 
     FT_ZERO( &storage );
+    FT_ZERO( &results );
 
     /* initialize the remaining objects */
     cf2_arrstack_init( &subrStack,
@@ -619,7 +622,7 @@
       if ( font->isT1 )
       {
         FT_ASSERT( known_othersubr_result_cnt == 0   ||
-                   unknown_othersubr_result_cnt == 0 );
+                   result_cnt == 0 );
       }
       
       if ( cf2_buf_isEnd( charstring ) )
@@ -645,14 +648,14 @@
 
       if ( font->isT1 )
       {
-        if ( unknown_othersubr_result_cnt > 0 &&
+        if ( result_cnt > 0 &&
              !( op1 == cf2_cmdCALLSUBR ||
                 op1 == cf2_cmdRETURN   ||
                 op1 == cf2_escPOP      ||
                 op1 >= 32 /* Numbers */ ) )
         {
           /* all operands have been transferred by previous pops */
-          unknown_othersubr_result_cnt = 0;
+          result_cnt = 0;
         }
 
         if ( large_int && !( op1 >= 32 || op1 == cf2_escDIV ) )
@@ -1461,17 +1464,18 @@
                       break;
                     }
 
-                    if ( unknown_othersubr_result_cnt == 0 )
+                    if ( result_cnt == 0 )
                     {
                       FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):"
                                  " no more operands for othersubr\n" ));
-                      goto Syntax_Error;
+                      lastError = FT_THROW( Invalid_Glyph_Format );
+                      goto exit;
                     }
 
-                    unknown_othersubr_result_cnt--;
-                    top++;   /* `push' the operand to callothersubr onto the 
stack */
+                    result_cnt--;
+                    cf2_stack_pushFixed( opStack, results[result_cnt] );
                   }
-                  break;
+                  continue; /* do not clear the stack */
                     
                 case cf2_escDROP:
                   FT_TRACE4(( " drop\n" ));



reply via email to

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