|
|
|
@ -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" |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -52,6 +56,8 @@ |
|
|
|
|
FT_ULong glyph_length = 0; |
|
|
|
|
PSAux_Service psaux = (PSAux_Service)face->psaux; |
|
|
|
|
|
|
|
|
|
FT_Bool force_scaling = FALSE; |
|
|
|
|
|
|
|
|
|
#ifdef FT_CONFIG_OPTION_INCREMENTAL |
|
|
|
|
FT_Incremental_InterfaceRec *inc = |
|
|
|
|
face->root.internal->incremental_interface; |
|
|
|
@ -169,9 +175,43 @@ |
|
|
|
|
if ( decoder->lenIV >= 0 ) |
|
|
|
|
psaux->t1_decrypt( charstring, glyph_length, 4330 ); |
|
|
|
|
|
|
|
|
|
error = decoder->funcs.parse_charstrings_old( |
|
|
|
|
decoder, charstring + cs_offset, |
|
|
|
|
glyph_length - cs_offset ); |
|
|
|
|
/* choose which renderer to use */ |
|
|
|
|
if ( ((PS_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 ); |
|
|
|
|
|
|
|
|
|
/* 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) */ |
|
|
|
|
((CID_GlyphSlot)decoder->builder.glyph)->hint = FALSE; |
|
|
|
|
|
|
|
|
|
force_scaling = TRUE; |
|
|
|
|
|
|
|
|
|
error = psaux->t1_decoder_funcs->parse_charstrings( &psdecoder, |
|
|
|
|
charstring + cs_offset, |
|
|
|
|
glyph_length - cs_offset ); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#ifdef FT_CONFIG_OPTION_INCREMENTAL |
|
|
|
@ -200,6 +240,8 @@ |
|
|
|
|
Exit: |
|
|
|
|
FT_FREE( charstring ); |
|
|
|
|
|
|
|
|
|
((CID_GlyphSlot)decoder->builder.glyph)->scaled = force_scaling; |
|
|
|
|
|
|
|
|
|
return error; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -288,6 +330,7 @@ |
|
|
|
|
T1_DecoderRec decoder; |
|
|
|
|
CID_Face face = (CID_Face)cidglyph->face; |
|
|
|
|
FT_Bool hinting; |
|
|
|
|
FT_Bool scaled; |
|
|
|
|
|
|
|
|
|
PSAux_Service psaux = (PSAux_Service)face->psaux; |
|
|
|
|
FT_Matrix font_matrix; |
|
|
|
@ -311,7 +354,10 @@ |
|
|
|
|
|
|
|
|
|
hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 && |
|
|
|
|
( load_flags & FT_LOAD_NO_HINTING ) == 0 ); |
|
|
|
|
scaled = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 ); |
|
|
|
|
|
|
|
|
|
glyph->hint = hinting; |
|
|
|
|
glyph->scaled = scaled; |
|
|
|
|
cidglyph->format = FT_GLYPH_FORMAT_OUTLINE; |
|
|
|
|
|
|
|
|
|
error = psaux->t1_decoder_funcs->init( &decoder, |
|
|
|
@ -337,6 +383,9 @@ |
|
|
|
|
if ( error ) |
|
|
|
|
goto Exit; |
|
|
|
|
|
|
|
|
|
hinting = glyph->hint; |
|
|
|
|
scaled = glyph->scaled; |
|
|
|
|
|
|
|
|
|
font_matrix = decoder.font_matrix; |
|
|
|
|
font_offset = decoder.font_offset; |
|
|
|
|
|
|
|
|
@ -410,7 +459,7 @@ |
|
|
|
|
metrics->vertAdvance += font_offset.y; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 ) |
|
|
|
|
if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 || scaled ) |
|
|
|
|
{ |
|
|
|
|
/* scale the outline and the metrics */ |
|
|
|
|
FT_Int n; |
|
|
|
|