freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] ewaldhew-wip 183ee22 16/52: [[moveto], [stem]] add hsbw/sbw


From: Hew Yih Shiuan Ewald
Subject: [freetype2] ewaldhew-wip 183ee22 16/52: [[moveto], [stem]] add hsbw/sbw first op check in t1 mode
Date: Mon, 10 Jul 2017 05:10:14 -0400 (EDT)

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

    [[moveto], [stem]] add hsbw/sbw first op check in t1 mode
---
 src/psaux/psintrp.c | 47 ++++++++++++++++++++++++-----------------------
 1 file changed, 24 insertions(+), 23 deletions(-)

diff --git a/src/psaux/psintrp.c b/src/psaux/psintrp.c
index 18f12c6..7ff7e67 100644
--- a/src/psaux/psintrp.c
+++ b/src/psaux/psintrp.c
@@ -291,8 +291,12 @@
     /* variable accumulates delta values from operand stack */
     CF2_Fixed  position = hintOffset;
 
-
-    if ( hasWidthArg && !*haveWidth )
+    if ( font->isT1 && !font->decoder->flex_state && !*haveWidth )
+    {
+      FT_ERROR(( "cf2_doStems (Type 1 mode):"
+                 " No width. Use hsbw/sbw as first op\n" ));
+    }
+    if ( !font->isT1 && hasWidthArg && !*haveWidth )
       *width = cf2_stack_getReal( opStack, 0 ) +
                  cf2_getNominalWidthX( font->decoder );
 
@@ -801,6 +805,12 @@
       case cf2_cmdVMOVETO:
         FT_TRACE4(( " vmoveto\n" ));
 
+        if ( font->isT1 && !decoder->flex_state && !haveWidth )
+        {
+          FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):"
+                     " No width. Use hsbw/sbw as first op\n" ));
+        }
+
         if ( cf2_stack_count( opStack ) > 1 && !haveWidth )
           *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ),
                               nominalWidthX );
@@ -811,13 +821,6 @@
         if ( font->decoder->width_only )
           goto exit;
 
-        if ( font->isT1 && !decoder->flex_state )
-        {
-          if ( builder->parse_state == T1_Parse_Start )
-            goto Syntax_Error;
-          builder->parse_state = T1_Parse_Have_Moveto;
-        }
-
         curY = ADD_INT32( curY, cf2_stack_popFixed( opStack ) );
 
         cf2_glyphpath_moveTo( &glyphPath, curX, curY );
@@ -1872,6 +1875,12 @@
       case cf2_cmdRMOVETO:
         FT_TRACE4(( " rmoveto\n" ));
 
+        if ( font->isT1 && !decoder->flex_state && !haveWidth )
+        {
+          FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):"
+                     " No width. Use hsbw/sbw as first op\n" ));
+        }
+
         if ( cf2_stack_count( opStack ) > 2 && !haveWidth )
           *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ),
                               nominalWidthX );
@@ -1882,13 +1891,6 @@
         if ( font->decoder->width_only )
           goto exit;
 
-        if ( font->isT1 && !decoder->flex_state )
-        {
-          if ( builder->parse_state == T1_Parse_Start )
-            goto Syntax_Error;
-          builder->parse_state = T1_Parse_Have_Moveto;
-        }
-
         curY = ADD_INT32( curY, cf2_stack_popFixed( opStack ) );
         curX = ADD_INT32( curX, cf2_stack_popFixed( opStack ) );
 
@@ -1899,6 +1901,12 @@
       case cf2_cmdHMOVETO:
         FT_TRACE4(( " hmoveto\n" ));
 
+        if ( font->isT1 && !decoder->flex_state && !haveWidth )
+        {
+          FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):"
+                     " No width. Use hsbw/sbw as first op\n" ));
+        }
+
         if ( cf2_stack_count( opStack ) > 1 && !haveWidth )
           *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ),
                               nominalWidthX );
@@ -1909,13 +1917,6 @@
         if ( font->decoder->width_only )
           goto exit;
 
-        if ( font->isT1 && !decoder->flex_state )
-        {
-          if ( builder->parse_state == T1_Parse_Start )
-            goto Syntax_Error;
-          builder->parse_state = T1_Parse_Have_Moveto;
-        }
-        
         curX = ADD_INT32( curX, cf2_stack_popFixed( opStack ) );
 
         cf2_glyphpath_moveTo( &glyphPath, curX, curY );



reply via email to

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