freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] ewaldhew-wip dc1fc53 2/2: [callothersubr] flex: fix


From: Hew Yih Shiuan Ewald
Subject: [freetype2] ewaldhew-wip dc1fc53 2/2: [callothersubr] flex: fix
Date: Mon, 17 Jul 2017 07:01:29 -0400 (EDT)

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

    [callothersubr] flex: fix
---
 src/psaux/psintrp.c | 29 ++++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)

diff --git a/src/psaux/psintrp.c b/src/psaux/psintrp.c
index bd2e713..4bfa4e3 100644
--- a/src/psaux/psintrp.c
+++ b/src/psaux/psintrp.c
@@ -504,6 +504,7 @@
     FT_Byte    op1;                       /* first opcode byte */
 
     CF2_F16Dot16  storage[CF2_STORAGE_SIZE];    /* for `put' and `get' */
+    CF2_F16Dot16  flexStore[6];                 /* for Type 1 flex */
 
     /* instruction limit; 20,000,000 matches Avalon */
     FT_UInt32  instructionLimit = 20000000UL;
@@ -527,6 +528,7 @@
 
     FT_ZERO( &storage );
     FT_ZERO( &results );
+    FT_ZERO( &flexStore );
 
     /* initialize the remaining objects */
     cf2_arrstack_init( &subrStack,
@@ -1686,8 +1688,7 @@
                       if ( arg_cnt != 0 )
                         goto Unexpected_OtherSubr;
 
-                      if ( ps_builder_start_point( &decoder->builder, curX, 
curY ) ||
-                           ps_builder_check_points( &decoder->builder, 6 )     
    )
+                      if ( ps_builder_check_points( &decoder->builder, 6 ) )
                         goto exit;
 
                       decoder->flex_state        = 1;
@@ -1697,6 +1698,7 @@
                     case 2:                     /* add flex vectors */
                     {
                       FT_Int  idx;
+                      FT_Int  idx2;
 
 
                       if ( arg_cnt != 0 )
@@ -1726,10 +1728,20 @@
                           goto exit;
                         }
 
-                        ps_builder_add_point( &decoder->builder,
-                                              curX,
-                                              curY,
-                                              (FT_Byte)( idx == 3 || idx == 6 
) );
+                        /* map: 1->2 2->4 3->6 4->2 5->4 6->6 */
+                        idx2 = ( idx > 3 ? idx - 3 : idx ) * 2;
+
+                        flexStore[idx2 - 2] = curX;
+                        flexStore[idx2 - 1] = curY;
+
+                        if ( idx == 3 || idx == 6 )
+                          cf2_glyphpath_curveTo( &glyphPath,
+                                                 flexStore[0],
+                                                 flexStore[1],
+                                                 flexStore[2],
+                                                 flexStore[3],
+                                                 flexStore[4],
+                                                 flexStore[5] );
                       }
                     }
                     break;
@@ -2318,8 +2330,6 @@
                     curY = cf2_stack_popFixed( opStack );
                     curX = cf2_stack_popFixed( opStack );
 
-                    cf2_glyphpath_moveTo( &glyphPath, curX, curY );
-
                     decoder->flex_state = 0;
                   }
                   break;
@@ -2541,7 +2551,8 @@
         curY = ADD_INT32( curY, cf2_stack_popFixed( opStack ) );
         curX = ADD_INT32( curX, cf2_stack_popFixed( opStack ) );
 
-        cf2_glyphpath_moveTo( &glyphPath, curX, curY );
+        if ( !decoder->flex_state )
+          cf2_glyphpath_moveTo( &glyphPath, curX, curY );
 
         break;
 



reply via email to

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