From 999a75b6dbfd24349b720fe6f600c37e8406f49e Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Mon, 25 Sep 2017 08:16:59 +0200 Subject: [PATCH] Minor fixes. * src/psaux/psintrp.c (cf2_interpT2CharString): Fix check for pop results. s/font->decoder/decoder/ where necessary. : Use offset parameter in `cf2_doStems' instead of doing correction for left-sidebearing. --- ChangeLog | 11 ++++++++ src/psaux/psintrp.c | 68 +++++++++++++++------------------------------ 2 files changed, 34 insertions(+), 45 deletions(-) diff --git a/ChangeLog b/ChangeLog index 26528c97c..0649aa66a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2017-09-25 Ewald Hew + + [psaux] Minor fixes. + + * src/psaux/psintrp.c (cf2_interpT2CharString): Fix check for pop + results. + s/font->decoder/decoder/ where necessary. + : Use + offset parameter in `cf2_doStems' instead of doing correction for + left-sidebearing. + 2017-09-25 Ewald Hew [cid] Use the new engine. diff --git a/src/psaux/psintrp.c b/src/psaux/psintrp.c index e4018c916..77f2632b8 100644 --- a/src/psaux/psintrp.c +++ b/src/psaux/psintrp.c @@ -653,7 +653,7 @@ if ( result_cnt > 0 && !( op1 == cf2_cmdCALLSUBR || op1 == cf2_cmdRETURN || - op1 == cf2_escPOP || + op1 == cf2_cmdESC || op1 >= 32 /* Numbers */ ) ) { /* all operands have been transferred by previous pops */ @@ -771,27 +771,16 @@ break; } } - else - { - /* Do lsb correction */ - CF2_F16Dot16 hint_pos; - - FT_ASSERT( ( cf2_stack_count( opStack ) == 2 ) ); - - hint_pos = ADD_INT32( cf2_stack_getReal( opStack, 0 ), - decoder->builder.left_bearing->y ); - - cf2_stack_setReal( opStack, 0, hint_pos ); - } cf2_doStems( font, opStack, &hStemHintArray, width, &haveWidth, - 0 ); + font->isT1 ? decoder->builder.left_bearing->y + : 0 ); - if ( font->decoder->width_only ) + if ( decoder->width_only ) goto exit; break; @@ -811,27 +800,16 @@ break; } } - else - { - /* Do lsb correction */ - CF2_F16Dot16 hint_pos; - - FT_ASSERT( ( cf2_stack_count( opStack ) == 2 ) ); - - hint_pos = ADD_INT32( cf2_stack_getReal( opStack, 0 ), - decoder->builder.left_bearing->x ); - - cf2_stack_setReal( opStack, 0, hint_pos ); - } cf2_doStems( font, opStack, &vStemHintArray, width, &haveWidth, - 0 ); + font->isT1 ? decoder->builder.left_bearing->x + : 0 ); - if ( font->decoder->width_only ) + if ( decoder->width_only ) goto exit; break; @@ -852,7 +830,7 @@ /* width is defined or default after this */ haveWidth = TRUE; - if ( font->decoder->width_only ) + if ( decoder->width_only ) goto exit; curY = ADD_INT32( curY, cf2_stack_popFixed( opStack ) ); @@ -1180,6 +1158,9 @@ { if ( font->isCFF2 || op2 >= cf2_escRESERVED_38 ) FT_TRACE4(( " unknown op (12, %d)\n", op2 )); + else if ( font->isT1 && result_cnt > 0 && op2 != cf2_escPOP ) + /* all operands have been transferred by previous pops */ + result_cnt = 0; else { /* second switch for 2-byte operators handles CFF and Type 1 */ @@ -1204,23 +1185,19 @@ else { CF2_F16Dot16 v0, v1, v2; - CF2_F16Dot16 lsb; - FT_TRACE4(( op2 == cf2_escVSTEM3 ? " vstem3\n" - : " hstem3\n" )); + FT_Bool isV = FT_BOOL( op2 == cf2_escVSTEM3 ); - FT_ASSERT( ( cf2_stack_count( opStack ) == 6 ) ); - lsb = ( op2 == cf2_escVSTEM3 ? decoder->builder.left_bearing->x - : decoder->builder.left_bearing->y ); + FT_TRACE4(( isV ? " vstem3\n" + : " hstem3\n" )); + + FT_ASSERT( ( cf2_stack_count( opStack ) == 6 ) ); v0 = cf2_stack_getReal( opStack, 0 ); v1 = cf2_stack_getReal( opStack, 2 ); v2 = cf2_stack_getReal( opStack, 4 ); - cf2_stack_setReal( opStack, 0, - ADD_INT32( v0, - lsb ) ); cf2_stack_setReal( opStack, 2, SUB_INT32( SUB_INT32( v1, v0 ), cf2_stack_getReal( opStack, 1 ) ) ); @@ -1230,10 +1207,11 @@ cf2_doStems( font, opStack, - op2 == cf2_escVSTEM3 ? &vStemHintArray : &hStemHintArray, + isV ? &vStemHintArray : &hStemHintArray, width, &haveWidth, - 0 ); + isV ? decoder->builder.left_bearing->x + : decoder->builder.left_bearing->y ); if ( decoder->width_only ) goto exit; @@ -2391,7 +2369,7 @@ /* width is defined or default after this */ haveWidth = TRUE; - if ( font->decoder->width_only ) + if ( decoder->width_only ) goto exit; /* close path if still open */ @@ -2479,7 +2457,7 @@ &haveWidth, 0 ); - if ( font->decoder->width_only ) + if ( decoder->width_only ) goto exit; if ( op1 == cf2_cmdHINTMASK ) @@ -2545,7 +2523,7 @@ /* width is defined or default after this */ haveWidth = TRUE; - if ( font->decoder->width_only ) + if ( decoder->width_only ) goto exit; curY = ADD_INT32( curY, cf2_stack_popFixed( opStack ) ); @@ -2572,7 +2550,7 @@ /* width is defined or default after this */ haveWidth = TRUE; - if ( font->decoder->width_only ) + if ( decoder->width_only ) goto exit; curX = ADD_INT32( curX, cf2_stack_popFixed( opStack ) );