freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] ewaldhew-wip 1c154a2 13/52: [[stem]] add t1 mode, lsb correc


From: Hew Yih Shiuan Ewald
Subject: [freetype2] ewaldhew-wip 1c154a2 13/52: [[stem]] add t1 mode, lsb correction
Date: Mon, 10 Jul 2017 05:10:14 -0400 (EDT)

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

    [[stem]] add t1 mode, lsb correction
---
 src/psaux/psintrp.c | 63 +++++++++++++++++++++++++++++++++++++++++++----------
 1 file changed, 51 insertions(+), 12 deletions(-)

diff --git a/src/psaux/psintrp.c b/src/psaux/psintrp.c
index a0e5771..362b32a 100644
--- a/src/psaux/psintrp.c
+++ b/src/psaux/psintrp.c
@@ -752,7 +752,8 @@
         FT_TRACE4(( op1 == cf2_cmdHSTEMHM ? " hstemhm\n" : " hstem\n" ));
 
         /* never add hints after the mask is computed */
-        if ( cf2_hintmask_isValid( &hintMask ) )
+        /* except if in Type 1 mode (no hintmask op)  */
+        if ( !font->isT1 && cf2_hintmask_isValid( &hintMask ) )
         {
           FT_TRACE4(( "cf2_interpT2CharString:"
                       " invalid horizontal hint mask\n" ));
@@ -776,7 +777,8 @@
         FT_TRACE4(( op1 == cf2_cmdVSTEMHM ? " vstemhm\n" : " vstem\n" ));
 
         /* never add hints after the mask is computed */
-        if ( cf2_hintmask_isValid( &hintMask ) )
+        /* except if in Type 1 mode (no hintmask op)  */
+        if ( !font->isT1 && cf2_hintmask_isValid( &hintMask ) )
         {
           FT_TRACE4(( "cf2_interpT2CharString:"
                       " invalid vertical hint mask\n" ));
@@ -1154,18 +1156,55 @@
                   break;
 
                 case cf2_escVSTEM3:
-                  if ( !font->isT1 )
-                    FT_TRACE4(( " unknown op (12, %d)\n", op2 ));
-                  else
-                  {
-                  }
-                  break;
-
                 case cf2_escHSTEM3:
-                  if ( !font->isT1 )
-                    FT_TRACE4(( " unknown op (12, %d)\n", op2 ));
-                  else
+                  /* Type 1:                     */ /* Type 2:                 
     */
+                  /* x0 dx0 x1 dx1 x2 dx2 vstem3 */ /* x dx {dxa dxb}* vstem   
     */
+                  /* y0 dy0 y1 dy1 y2 dy2 hstem3 */ /* y dy {dya dyb}* hstem   
     */
+                  /* relative to lsb point       */ /* relative to zero        
     */
                   {
+                    if ( !font->isT1 )
+                      FT_TRACE4(( " unknown op (12, %d)\n", op2 ));
+                    else
+                    {
+                      CF2_F16Dot16  v0, dv0, v1, dv1, v2, dv2;
+                      CF2_F16Dot16  lsb;
+                      
+                      FT_TRACE4(( op2 == cf2_escVSTEM3 ? " vstem3\n"
+                                                       : " hstem3\n" ));
+
+                      v0  = cf2_stack_popFixed( opStack );
+                      dv0 = cf2_stack_popFixed( opStack );
+                      v1  = cf2_stack_popFixed( opStack );
+                      dv1 = cf2_stack_popFixed( opStack );
+                      v2  = cf2_stack_popFixed( opStack );
+                      dv2 = cf2_stack_popFixed( opStack );
+
+                      lsb = ( op2 == cf2_escVSTEM3 ? 
font->decoder->builder->left_bearing.x
+                                                   : 
font->decoder->builder->left_bearing.y );
+
+                      cf2_stack_pushFixed( opStack, ADD_INT32( v0, lsb ) );
+                      cf2_stack_pushFixed( opStack, dv0 );
+
+                      cf2_stack_pushFixed( opStack, SUB_INT32( SUB_INT32 ( v1,
+                                                                           v0 
),
+                                                                          dv0 
) );
+                      cf2_stack_pushFixed( opStack, dv1 );
+
+                      cf2_stack_pushFixed( opStack, SUB_INT32( SUB_INT32 ( v2,
+                                                                           v1 
),
+                                                                          dv1 
) );
+                      cf2_stack_pushFixed( opStack, dv2 );
+                      
+                      cf2_doStems( font,
+                                   opStack,
+                                   op2 == cf2_escVSTEM3 ? &vStemHintArray : 
&hStemHintArray,
+                                   width,
+                                   &haveWidth,
+                                   0 );
+
+                      if ( decoder->width_only )
+                        goto exit;
+                    }
                   }
                   break;
 



reply via email to

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