freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] ewaldhew-wip 48e4f8e 18/47: [pop] change unknown_othersubr_r


From: Hew Yih Shiuan Ewald
Subject: [freetype2] ewaldhew-wip 48e4f8e 18/47: [pop] change unknown_othersubr_result_cnt behaviour
Date: Thu, 6 Jul 2017 04:49:34 -0400 (EDT)

branch: ewaldhew-wip
commit 48e4f8e1894874d800caec4cb1b09d599f82a1ba
Author: Ewald Hew <address@hidden>
Commit: Ewald Hew <address@hidden>

    [pop] change unknown_othersubr_result_cnt behaviour
---
 src/psaux/psintrp.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/src/psaux/psintrp.c b/src/psaux/psintrp.c
index 82d6107..9751251 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 ) )
@@ -1460,20 +1463,21 @@
                     {
                       known_othersubr_result_cnt--;
                       /* ignore, we pushed the operands ourselves */
-                      break;
+                      continue;
                     }
 
-                    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]