From 2959d7315824012416b22fa76f1b5aa112cdffb8 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Wed, 3 Jan 2018 10:09:45 +0800 Subject: [PATCH] off hinting if hintmap full --- src/psaux/pshints.c | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/src/psaux/pshints.c b/src/psaux/pshints.c index b53ca6745..3d77b0a5d 100644 --- a/src/psaux/pshints.c +++ b/src/psaux/pshints.c @@ -760,6 +760,7 @@ if ( iDst >= CF2_MAX_HINT_EDGES ) { FT_TRACE4(( "cf2_hintmap_insertHint: too many hintmaps\n" )); + hintmap->hinted = FALSE; return; } @@ -836,7 +837,7 @@ TRUE ); } - if ( !cf2_hintmask_isValid( hintMask ) ) + if ( !cf2_hintmask_isValid( hintMask ) && !font->isT1 ) { /* without a hint mask, assume all hints are active */ cf2_hintmask_setAll( hintMask, @@ -858,7 +859,7 @@ bitCount = cf2_arrstack_size( hStemHintArray ); /* Defense-in-depth. Should never return here. */ - if ( bitCount > hintMask->bitCount ) + if ( bitCount > hintMask->bitCount && !font->isT1 ) return; /* synthetic embox hints get highest priority */ @@ -884,7 +885,7 @@ /* priority) */ for ( i = 0, maskByte = 0x80; i < bitCount; i++ ) { - if ( maskByte & *maskPtr ) + if ( font->isT1 || ( maskByte & *maskPtr ) ) { /* expand StemHint into two `CF2_Hint' elements */ CF2_HintRec bottomHintEdge, topHintEdge; @@ -918,14 +919,17 @@ } } - if ( ( i & 7 ) == 7 ) + if ( !font->isT1 ) { - /* move to next mask byte */ - maskPtr++; - maskByte = 0x80; + if ( ( i & 7 ) == 7 ) + { + /* move to next mask byte */ + maskPtr++; + maskByte = 0x80; + } + else + maskByte >>= 1; } - else - maskByte >>= 1; } /* initial hint map includes only captured hints plus maybe one at 0 */ @@ -985,7 +989,7 @@ for ( i = 0, maskByte = 0x80; i < bitCount; i++ ) { - if ( maskByte & *maskPtr ) + if ( font->isT1 || ( maskByte & *maskPtr ) ) { CF2_HintRec bottomHintEdge, topHintEdge; @@ -1008,14 +1012,17 @@ cf2_hintmap_insertHint( hintmap, &bottomHintEdge, &topHintEdge ); } - if ( ( i & 7 ) == 7 ) + if ( !font->isT1 ) { - /* move to next mask byte */ - maskPtr++; - maskByte = 0x80; + if ( ( i & 7 ) == 7 ) + { + /* move to next mask byte */ + maskPtr++; + maskByte = 0x80; + } + else + maskByte >>= 1; } - else - maskByte >>= 1; } } -- 2.11.0