[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2] ewaldhew-wip 2f04817 6/7: add cid support
From: |
Hew Yih Shiuan Ewald |
Subject: |
[freetype2] ewaldhew-wip 2f04817 6/7: add cid support |
Date: |
Wed, 19 Jul 2017 05:21:00 -0400 (EDT) |
branch: ewaldhew-wip
commit 2f048171ec911d94e74bc266a70a0121c1fc4ba9
Author: Ewald Hew <address@hidden>
Commit: Ewald Hew <address@hidden>
add cid support
---
src/cid/cidgload.c | 47 ++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 44 insertions(+), 3 deletions(-)
diff --git a/src/cid/cidgload.c b/src/cid/cidgload.c
index b96c333..1b95902 100644
--- a/src/cid/cidgload.c
+++ b/src/cid/cidgload.c
@@ -24,6 +24,10 @@
#include FT_OUTLINE_H
#include FT_INTERNAL_CALC_H
+#include FT_INTERNAL_POSTSCRIPT_AUX_H
+#include FT_INTERNAL_CFF_TYPES_H
+#include FT_TYPE1_DRIVER_H
+
#include "ciderrs.h"
@@ -169,9 +173,45 @@
if ( decoder->lenIV >= 0 )
psaux->t1_decrypt( charstring, glyph_length, 4330 );
- error = decoder->funcs.parse_charstrings(
- decoder, charstring + cs_offset,
- glyph_length - cs_offset );
+ /* choose which renderer to use */
+ if ( ((CFF_Driver)FT_FACE_DRIVER( face ))->hinting_engine ==
FT_T1_HINTING_FREETYPE ||
+ decoder->builder.metrics_only )
+ error = psaux->t1_decoder_funcs->parse_charstrings_old( decoder,
+ charstring +
cs_offset,
+ glyph_length -
cs_offset );
+ else
+ {
+ PS_Decoder psdecoder;
+ CFF_SubFontRec subfont;
+
+
+ psaux->ps_decoder_init( decoder, TRUE, &psdecoder );
+
+ psaux->t1_make_subfont( FT_FACE( face ), &dict->private_dict, &subfont
);
+ psdecoder.current_subfont = &subfont;
+
+ error = psaux->t1_decoder_funcs->parse_charstrings( &psdecoder,
+ charstring +
cs_offset,
+ glyph_length -
cs_offset );
+
+#if 0
+ /* Adobe's engine uses 16.16 numbers everywhere; */
+ /* as a consequence, glyphs larger than 2000ppem get rejected */
+ if ( FT_ERR_EQ( error, Glyph_Too_Big ) )
+ {
+ /* this time, we retry unhinted and scale up the glyph later on */
+ /* (the engine uses and sets the hardcoded value 0x10000 / 64 = */
+ /* 0x400 for both `x_scale' and `y_scale' in this case) */
+ hinting = FALSE;
+ force_scaling = TRUE;
+ glyph->hint = hinting;
+
+ error = psaux->t1_decoder_funcs->parse_charstrings( &psdecoder,
+ charstring +
cs_offset,
+ glyph_length -
cs_offset );
+ }
+#endif
+ }
}
#ifdef FT_CONFIG_OPTION_INCREMENTAL
@@ -312,6 +352,7 @@
hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 &&
( load_flags & FT_LOAD_NO_HINTING ) == 0 );
+ glyph->hint = hinting;
cidglyph->format = FT_GLYPH_FORMAT_OUTLINE;
error = psaux->t1_decoder_funcs->init( &decoder,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2] ewaldhew-wip 2f04817 6/7: add cid support,
Hew Yih Shiuan Ewald <=