diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cff/cffdrivr.c | 8 | ||||
-rw-r--r-- | src/cff/cffgload.c | 52 | ||||
-rw-r--r-- | src/cff/cffgload.h | 2 | ||||
-rw-r--r-- | src/cff/cffobjs.c | 4 |
4 files changed, 49 insertions, 17 deletions
diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index 0bbbed076..c8ca96ba4 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -38,6 +38,7 @@ #include FT_SERVICE_XFREE86_NAME_H #include FT_SERVICE_GLYPH_DICT_H #include FT_SERVICE_PROPERTIES_H +#include FT_CFF_DRIVER_H /*************************************************************************/ @@ -590,7 +591,12 @@ FT_UInt* hinting_engine = (FT_UInt*)value; - driver->hinting_engine = *hinting_engine; +#ifndef CFF_CONFIG_OPTION_OLD_ENGINE + if ( *hinting_engine != FT_CFF_HINTING_ADOBE ) + error = FT_ERR( Unimplemented_Feature ); + else +#endif + driver->hinting_engine = *hinting_engine; return error; } diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c index 4b6f417a1..1904ca019 100644 --- a/src/cff/cffgload.c +++ b/src/cff/cffgload.c @@ -41,6 +41,8 @@ #define FT_COMPONENT trace_cffgload +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + typedef enum CFF_Operator_ { cff_op_unknown = 0, @@ -211,6 +213,8 @@ 2 /* setcurrentpoint */ }; +#endif /* CFF_CONFIG_OPTION_OLD_ENGINE */ + /*************************************************************************/ /*************************************************************************/ @@ -485,22 +489,24 @@ if ( builder->load_points ) { - CFF_Driver driver = (CFF_Driver)FT_FACE_DRIVER( builder->face ); - FT_Vector* point = outline->points + outline->n_points; FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points; +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + CFF_Driver driver = (CFF_Driver)FT_FACE_DRIVER( builder->face ); - if ( driver->hinting_engine == FT_CFF_HINTING_ADOBE ) + + if ( driver->hinting_engine == FT_CFF_HINTING_FREETYPE ) { - /* cf2_decoder_parse_charstrings uses 16.16 coordinates */ - point->x = x >> 10; - point->y = y >> 10; + point->x = x >> 16; + point->y = y >> 16; } else +#endif { - point->x = x >> 16; - point->y = y >> 16; + /* cf2_decoder_parse_charstrings uses 16.16 coordinates */ + point->x = x >> 10; + point->y = y >> 10; } *control = (FT_Byte)( flag ? FT_CURVE_TAG_ON : FT_CURVE_TAG_CUBIC ); } @@ -722,6 +728,8 @@ } +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + static FT_Error cff_operator_seac( CFF_Decoder* decoder, FT_Pos asb, @@ -2518,6 +2526,8 @@ return FT_THROW( Stack_Overflow ); } +#endif /* CFF_CONFIG_OPTION_OLD_ENGINE */ + /*************************************************************************/ /*************************************************************************/ @@ -2794,7 +2804,10 @@ glyph->root.format = FT_GLYPH_FORMAT_OUTLINE; /* by default */ { +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE CFF_Driver driver = (CFF_Driver)FT_FACE_DRIVER( face ); +#endif + FT_Byte* charstring; FT_ULong charstring_len; @@ -2819,20 +2832,27 @@ if ( error ) goto Glyph_Build_Finished; +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE /* choose which CFF renderer to use */ - if ( driver->hinting_engine == FT_CFF_HINTING_ADOBE ) - error = cf2_decoder_parse_charstrings( &decoder, + if ( driver->hinting_engine == FT_CFF_HINTING_FREETYPE ) + error = cff_decoder_parse_charstrings( &decoder, charstring, charstring_len ); - - /* 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 ) || - driver->hinting_engine == FT_CFF_HINTING_FREETYPE ) - error = cff_decoder_parse_charstrings( &decoder, + else +#endif + { + error = cf2_decoder_parse_charstrings( &decoder, charstring, charstring_len ); + /* 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 ) ) + { + /* XXX to be implemented */ + } + } + cff_free_glyph_data( face, &charstring, charstring_len ); if ( error ) diff --git a/src/cff/cffgload.h b/src/cff/cffgload.h index 11b389e21..41df7db69 100644 --- a/src/cff/cffgload.h +++ b/src/cff/cffgload.h @@ -218,10 +218,12 @@ FT_BEGIN_HEADER #endif /* 0 */ +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE FT_LOCAL( FT_Error ) cff_decoder_parse_charstrings( CFF_Decoder* decoder, FT_Byte* charstring_base, FT_ULong charstring_len ); +#endif FT_LOCAL( FT_Error ) cff_slot_load( CFF_GlyphSlot glyph, diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c index ebcf18936..90a9a33a8 100644 --- a/src/cff/cffobjs.c +++ b/src/cff/cffobjs.c @@ -1056,7 +1056,11 @@ /* set default property values */ +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE driver->hinting_engine = FT_CFF_HINTING_FREETYPE; +#else + driver->hinting_engine = FT_CFF_HINTING_ADOBE; +#endif driver->no_stem_darkening = FALSE; return FT_Err_Ok; |