freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] ewaldhew-wip bee5e97 16/29: [[moveto], [stem]] add hsbw/sbw


From: Hew Yih Shiuan Ewald
Subject: [freetype2] ewaldhew-wip bee5e97 16/29: [[moveto], [stem]] add hsbw/sbw first op check in t1 mode
Date: Mon, 26 Jun 2017 01:55:04 -0400 (EDT)

branch: ewaldhew-wip
commit bee5e97e6749ec852dd958be8f54b8d5bba6756f
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 a4dbb8c..f73dc2d 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 );
@@ -1870,6 +1873,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 );
@@ -1880,13 +1889,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 ) );
 
@@ -1897,6 +1899,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 );
@@ -1907,13 +1915,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]