freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] ewaldhew-wip ce0d3f2 24/47: [callothersubr] Fixes, minor for


From: Hew Yih Shiuan Ewald
Subject: [freetype2] ewaldhew-wip ce0d3f2 24/47: [callothersubr] Fixes, minor formatting changes
Date: Thu, 6 Jul 2017 04:49:36 -0400 (EDT)

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

    [callothersubr] Fixes, minor formatting changes
---
 src/psaux/psintrp.c | 58 ++++++++++++++++++++++++++++++++---------------------
 1 file changed, 35 insertions(+), 23 deletions(-)

diff --git a/src/psaux/psintrp.c b/src/psaux/psintrp.c
index d2b5d8b..531e5cf 100644
--- a/src/psaux/psintrp.c
+++ b/src/psaux/psintrp.c
@@ -490,8 +490,11 @@
     CF2_Fixed  nominalWidthX = cf2_getNominalWidthX( decoder );
 
     /* Stuff for Type 1 */
-    FT_Int     known_othersubr_result_cnt   = 0;
+    FT_Int     known_othersubr_result_cnt = 0;
     FT_Bool    large_int;
+#define PS_STORAGE_SIZE 3
+    CF2_F16Dot16  results[PS_STORAGE_SIZE];   /* for othersubr results */
+    FT_Int        result_cnt = 0;
     
     /* save this for hinting seac accents */
     CF2_Fixed  hintOriginY = curY;
@@ -500,10 +503,7 @@
     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;
@@ -1482,7 +1482,7 @@
 
                     opIdx += count - arg_cnt;
 
-                    known_othersubr_result_cnt   = 0;
+                    known_othersubr_result_cnt = 0;
                     result_cnt = 0;
 
                     /* XXX TODO: The checks to `arg_count == <whatever>'       
*/
@@ -1512,14 +1512,13 @@
                       {
                         FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):"
                                    " unexpected flex end\n" ));
-                        goto Syntax_Error;
+                        lastError = FT_THROW( Invalid_Glyph_Format );
+                        goto exit;
                       }
 
                       /* the two `results' are popped by the following 
setcurrentpoint */
-                      results[result_cnt + 0] = x;
-                      results[result_cnt + 1] = y;
-
-                      result_cnt += 2;
+                      cf2_stack_pushFixed( opStack, curX );
+                      cf2_stack_pushFixed( opStack, curY );
                       known_othersubr_result_cnt = 2;
                       break;
 
@@ -1527,9 +1526,9 @@
                       if ( arg_cnt != 0 )
                         goto Unexpected_OtherSubr;
 
-                      if ( FT_SET_ERROR( t1_builder_start_point( builder, x, y 
) ) ||
+                      if ( FT_SET_ERROR( t1_builder_start_point( builder, 
curX, curY ) ) ||
                            FT_SET_ERROR( t1_builder_check_points( builder, 6 ) 
)   )
-                        goto Fail;
+                        goto exit;
 
                       decoder->flex_state        = 1;
                       decoder->num_flex_vectors  = 0;
@@ -1568,8 +1567,8 @@
                         }
 
                         t1_builder_add_point( builder,
-                                              x,
-                                              y,
+                                              curX,
+                                              curY,
                                               (FT_Byte)( idx == 3 || idx == 6 
) );
                       }
                     }
@@ -1581,6 +1580,8 @@
 
                       cf2_arrstack_clear( &vStemHintArray );
                       cf2_arrstack_clear( &hStemHintArray );
+
+                      known_othersubr_result_cnt = 1;
                       break;
 
                     case 12:
@@ -1597,8 +1598,8 @@
                     {
                       PS_Blend  blend = decoder->blend;
                       FT_UInt   num_points, nn, mm;
-                      FT_Long*  delta;
-                      FT_Long*  values;
+                      CF2_UInt  delta;
+                      CF2_UInt  values;
 
 
                       if ( !blend )
@@ -1634,20 +1635,22 @@
                       /* I guess that's why it's written in this `compact'     
*/
                       /* form.                                                 
*/
                       /*                                                       
*/
-                      delta  = top + num_points;
-                      values = top;
+                      delta  = opIdx + num_points;
+                      values = opIdx;
                       for ( nn = 0; nn < num_points; nn++ )
                       {
-                        FT_Long  tmp = values[0];
+                        CF2_Fixed  tmp = cf2_stack_getReal( opStack, values );
 
 
                         for ( mm = 1; mm < blend->num_designs; mm++ )
-                          tmp = ADD_LONG( tmp,
-                                          FT_MulFix( *delta++,
-                                                     blend->weight_vector[mm] 
) );
+                          tmp = ADD_INT32( tmp,
+                                           FT_MulFix( cf2_stack_getReal( 
opStack, delta++ ),
+                                                      blend->weight_vector[mm] 
) );
 
-                        *values++ = tmp;
+                        cf2_stack_setReal( opStack, values++, tmp );
                       }
+                      cf2_stack_pop( opStack,
+                                     arg_cnt - num_points );
 
                       known_othersubr_result_cnt = (FT_Int)num_points;
                       break;
@@ -1694,6 +1697,7 @@
                       cf2_stack_pushFixed( opStack,
                                            ADD_INT32( summand1,
                                                       summand2 ) );
+                      known_othersubr_result_cnt = 1;
                     }
                     break;
 
@@ -1712,6 +1716,7 @@
 
                       cf2_stack_pushFixed( opStack,
                                            SUB_INT32( minuend, subtrahend ) );
+                      known_othersubr_result_cnt = 1;
                     }
                     break;
 
@@ -1730,6 +1735,7 @@
 
                       cf2_stack_pushFixed( opStack,
                                            FT_MulFix( factor1, factor2 ) );
+                      known_othersubr_result_cnt = 1;
                     }
                     break;
 
@@ -1751,6 +1757,7 @@
 
                       cf2_stack_pushFixed( opStack,
                                            FT_DivFix( dividend, divisor ) );
+                      known_othersubr_result_cnt = 1;
                     }
                     break;
 
@@ -1793,6 +1800,7 @@
 
                       cf2_stack_pushFixed( opStack,
                                            decoder->buildchar[idx] );
+                      known_othersubr_result_cnt = 1;
                     }
                     break;
 
@@ -1825,6 +1833,7 @@
 
                       cf2_stack_pushFixed( opStack,
                                            cond1 <= cond2 ? arg1 : arg2 );
+                      known_othersubr_result_cnt = 1;
                     }
                     break;
 
@@ -1846,6 +1855,7 @@
                         cff_random( decoder->current_subfont->random );
 
                       cf2_stack_pushFixed( opStack, r );
+                      known_othersubr_result_cnt = 1;
                     }
                     break;
 
@@ -1860,6 +1870,8 @@
 
                         /* Store the unused args for this unhandled OtherSubr 
*/
 
+                        if ( arg_cnt > PS_STORAGE_SIZE )
+                          arg_cnt = PS_STORAGE_SIZE;
                         result_cnt = arg_cnt;
 
                         for ( i = 1; i <= arg_cnt; i++ )



reply via email to

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