diff options
-rw-r--r-- | include/freetype/internal/cffotypes.h | 113 | ||||
-rw-r--r-- | include/freetype/internal/cfftypes.h (renamed from src/cff/cfftypes.h) | 4 | ||||
-rw-r--r-- | include/freetype/internal/internal.h | 3 | ||||
-rw-r--r-- | include/freetype/internal/psaux.h | 108 | ||||
-rw-r--r-- | include/freetype/internal/services/svcfftl.h | 1 | ||||
-rw-r--r-- | include/freetype/internal/tttypes.h | 3 | ||||
-rw-r--r-- | src/cff/cff.c | 11 | ||||
-rw-r--r-- | src/cff/cffcmap.h | 2 | ||||
-rw-r--r-- | src/cff/cffdrivr.c | 1 | ||||
-rw-r--r-- | src/cff/cffgload.c | 10 | ||||
-rw-r--r-- | src/cff/cffgload.h | 2 | ||||
-rw-r--r-- | src/cff/cffload.h | 4 | ||||
-rw-r--r-- | src/cff/cffobjs.h | 100 | ||||
-rw-r--r-- | src/cff/cffparse.h | 2 | ||||
-rw-r--r-- | src/cff/rules.mk | 3 | ||||
-rw-r--r-- | src/psaux/cf2ft.h | 2 | ||||
-rw-r--r-- | src/psaux/cffdecode.c | 4 | ||||
-rw-r--r-- | src/psaux/cffdecode.h | 22 | ||||
-rw-r--r-- | src/psaux/psaux.c | 10 | ||||
-rw-r--r-- | src/psaux/psauxmod.c | 2 | ||||
-rw-r--r-- | src/psaux/psobjs.c | 4 | ||||
-rw-r--r-- | src/psaux/psobjs.h | 1 |
22 files changed, 218 insertions, 194 deletions
diff --git a/include/freetype/internal/cffotypes.h b/include/freetype/internal/cffotypes.h new file mode 100644 index 000000000..6cabaff17 --- /dev/null +++ b/include/freetype/internal/cffotypes.h @@ -0,0 +1,113 @@ +#ifndef CFFOTYPES_H_ +#define CFFOTYPES_H_ + +#include <ft2build.h> +#include FT_INTERNAL_OBJECTS_H +#include FT_INTERNAL_CFF_TYPES_H +#include FT_INTERNAL_TRUETYPE_TYPES_H +#include FT_SERVICE_POSTSCRIPT_CMAPS_H +#include FT_INTERNAL_POSTSCRIPT_HINTS_H + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* CFF_Driver */ + /* */ + /* <Description> */ + /* A handle to an OpenType driver object. */ + /* */ + typedef struct CFF_DriverRec_* CFF_Driver; + + typedef TT_Face CFF_Face; + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* CFF_Size */ + /* */ + /* <Description> */ + /* A handle to an OpenType size object. */ + /* */ + typedef struct CFF_SizeRec_ + { + FT_SizeRec root; + FT_ULong strike_index; /* 0xFFFFFFFF to indicate invalid */ + + } CFF_SizeRec, *CFF_Size; + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* CFF_GlyphSlot */ + /* */ + /* <Description> */ + /* A handle to an OpenType glyph slot object. */ + /* */ + typedef struct CFF_GlyphSlotRec_ + { + FT_GlyphSlotRec root; + + FT_Bool hint; + FT_Bool scaled; + + FT_Fixed x_scale; + FT_Fixed y_scale; + + } CFF_GlyphSlotRec, *CFF_GlyphSlot; + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* CFF_Internal */ + /* */ + /* <Description> */ + /* The interface to the `internal' field of `FT_Size'. */ + /* */ + typedef struct CFF_InternalRec_ + { + PSH_Globals topfont; + PSH_Globals subfonts[CFF_MAX_CID_FONTS]; + + } CFF_InternalRec, *CFF_Internal; + + + /*************************************************************************/ + /* */ + /* Subglyph transformation record. */ + /* */ + typedef struct CFF_Transform_ + { + FT_Fixed xx, xy; /* transformation matrix coefficients */ + FT_Fixed yx, yy; + FT_F26Dot6 ox, oy; /* offsets */ + + } CFF_Transform; + + + /***********************************************************************/ + /* */ + /* CFF driver class. */ + /* */ + typedef struct CFF_DriverRec_ + { + FT_DriverRec root; + + FT_UInt hinting_engine; + FT_Bool no_stem_darkening; + FT_Int darken_params[8]; + FT_Int32 random_seed; + + } CFF_DriverRec; + + +FT_END_HEADER + + +#endif diff --git a/src/cff/cfftypes.h b/include/freetype/internal/cfftypes.h index c2b917675..d6de1f33c 100644 --- a/src/cff/cfftypes.h +++ b/include/freetype/internal/cfftypes.h @@ -397,10 +397,6 @@ FT_BEGIN_HEADER /* since version 2.7.1 */ CFF_VStoreRec vstore; /* parsed vstore structure */ - /* interface to PostScript Aux service */ - //TODO(ewaldhew): should this be in ttface? - PSAux_Service psaux; - } CFF_FontRec; diff --git a/include/freetype/internal/internal.h b/include/freetype/internal/internal.h index 02046813a..23f84b435 100644 --- a/include/freetype/internal/internal.h +++ b/include/freetype/internal/internal.h @@ -47,6 +47,9 @@ #define FT_INTERNAL_AUTOHINT_H <freetype/internal/autohint.h> +#define FT_INTERNAL_CFF_TYPES_H <freetype/internal/cfftypes.h> +#define FT_INTERNAL_CFF_OBJECTS_TYPES_H <freetype/internal/cffotypes.h> + #if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */ diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h index f015c88dd..3f710ae6f 100644 --- a/include/freetype/internal/psaux.h +++ b/include/freetype/internal/psaux.h @@ -27,7 +27,9 @@ #include FT_INTERNAL_HASH_H #include FT_INTERNAL_TRUETYPE_TYPES_H #include FT_SERVICE_POSTSCRIPT_CMAPS_H -/*TODO(ewaldhew): link cffobjs.h: move it to freetype/internal? */ +#include FT_INTERNAL_CFF_TYPES_H +#include FT_INTERNAL_CFF_OBJECTS_TYPES_H + FT_BEGIN_HEADER @@ -712,7 +714,57 @@ FT_BEGIN_HEADER /*************************************************************************/ - typedef struct CFF_Builder_FuncsRec_ CFF_Builder_FuncsRec; + typedef struct CFF_Builder_ CFF_Builder; + + + typedef FT_Error + (*CFF_Builder_Check_Points_Func)( CFF_Builder* builder, + FT_Int count ); + + typedef void + (*CFF_Builder_Add_Point_Func)( CFF_Builder* builder, + FT_Pos x, + FT_Pos y, + FT_Byte flag ); + typedef FT_Error + (*CFF_Builder_Add_Point1_Func)( CFF_Builder* builder, + FT_Pos x, + FT_Pos y ); + typedef FT_Error + (*CFF_Builder_Start_Point_Func)( CFF_Builder* builder, + FT_Pos x, + FT_Pos y ); + typedef void + (*CFF_Builder_Close_Contour_Func)( CFF_Builder* builder ); + + /* static */ + typedef FT_Error + (*CFF_Builder_Add_Contour_Func)( CFF_Builder* builder ); + + typedef const struct CFF_Builder_FuncsRec_* CFF_Builder_Funcs; + + typedef struct CFF_Builder_FuncsRec_ + { + /* static */ + void + (*init)( CFF_Builder* builder, + TT_Face face, + CFF_Size size, + CFF_GlyphSlot glyph, + FT_Bool hinting ); + + /* static */ + void + (*done)( CFF_Builder* builder ); + + CFF_Builder_Check_Points_Func check_points; + CFF_Builder_Add_Point_Func add_point; + CFF_Builder_Add_Point1_Func add_point1; + CFF_Builder_Add_Contour_Func add_contour; + CFF_Builder_Start_Point_Func start_point; + CFF_Builder_Close_Contour_Func close_contour; + + } CFF_Builder_FuncsRec; /*************************************************************************/ @@ -760,7 +812,7 @@ FT_BEGIN_HEADER /* */ /* hints_globals :: Auxiliary pointer for hinting. */ /* */ - typedef struct CFF_Builder_ + struct CFF_Builder_ { FT_Memory memory; TT_Face face; @@ -787,56 +839,6 @@ FT_BEGIN_HEADER CFF_Builder_FuncsRec funcs; - } CFF_Builder; - - - typedef FT_Error - (*CFF_Builder_Check_Points_Func)( CFF_Builder* builder, - FT_Int count ); - - typedef void - (*CFF_Builder_Add_Point_Func)( CFF_Builder* builder, - FT_Pos x, - FT_Pos y, - FT_Byte flag ); - typedef FT_Error - (*CFF_Builder_Add_Point1_Func)( CFF_Builder* builder, - FT_Pos x, - FT_Pos y ); - typedef FT_Error - (*CFF_Builder_Start_Point_Func)( CFF_Builder* builder, - FT_Pos x, - FT_Pos y ); - typedef void - (*CFF_Builder_Close_Contour_Func)( CFF_Builder* builder ); - - /* static */ - typedef FT_Error - (*CFF_Builder_Add_Contour_Func)( CFF_Builder* builder ); - - typedef const struct CFF_Builder_FuncsRec_* CFF_Builder_Funcs; - - struct CFF_Builder_FuncsRec_ - { - /* static */ - void - (*init)( CFF_Builder* builder, - TT_Face face, - CFF_Size size, - CFF_GlyphSlot glyph, - FT_Bool hinting ); - - /* static */ - void - (*done)( CFF_Builder* builder ); - - CFF_Builder_Check_Points_Func check_points; - CFF_Builder_Add_Point_Func add_point; - CFF_Builder_Add_Point1_Func add_point1; - CFF_Builder_Start_Point_Func start_point; - CFF_Builder_Close_Contour_Func close_contour; - CFF_Builder_Add_Contour_Func add_contour; - }; diff --git a/include/freetype/internal/services/svcfftl.h b/include/freetype/internal/services/svcfftl.h index 6270bcf3d..4629cbc53 100644 --- a/include/freetype/internal/services/svcfftl.h +++ b/include/freetype/internal/services/svcfftl.h @@ -2,6 +2,7 @@ #define SVCFFTL_H_ #include FT_INTERNAL_SERVICE_H +#include FT_INTERNAL_CFF_TYPES_H FT_BEGIN_HEADER diff --git a/include/freetype/internal/tttypes.h b/include/freetype/internal/tttypes.h index c0758e25f..0fcc6b04d 100644 --- a/include/freetype/internal/tttypes.h +++ b/include/freetype/internal/tttypes.h @@ -1445,6 +1445,9 @@ FT_BEGIN_HEADER void* var; #endif + /* a typeless pointer to the PostScript Aux service */ + void* psaux; + /***********************************************************************/ /* */ diff --git a/src/cff/cff.c b/src/cff/cff.c index 397f6dfaf..e9b3264b8 100644 --- a/src/cff/cff.c +++ b/src/cff/cff.c @@ -27,15 +27,4 @@ #include "cffload.c" #include "cffobjs.c" -#include "cf2arrst.c" -#include "cf2blues.c" -#include "cf2error.c" -#include "cf2font.c" -#include "cf2ft.c" -#include "cf2hints.c" -#include "cf2intrp.c" -#include "cf2read.c" -#include "cf2stack.c" - - /* END */ diff --git a/src/cff/cffcmap.h b/src/cff/cffcmap.h index 7792e0424..227c91afb 100644 --- a/src/cff/cffcmap.h +++ b/src/cff/cffcmap.h @@ -19,7 +19,7 @@ #ifndef CFFCMAP_H_ #define CFFCMAP_H_ -#include "cffobjs.h" +#include FT_INTERNAL_CFF_OBJECTS_TYPES_H FT_BEGIN_HEADER diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index 689f22979..4c9b1cd99 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -32,6 +32,7 @@ #include "cffload.h" #include "cffcmap.h" #include "cffparse.h" +#include "cffobjs.h" #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT #include FT_SERVICE_MULTIPLE_MASTERS_H diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c index 4047391c6..c27f74c3f 100644 --- a/src/cff/cffgload.c +++ b/src/cff/cffgload.c @@ -25,10 +25,10 @@ #include FT_OUTLINE_H #include FT_CFF_DRIVER_H -#include "cffobjs.h" #include "cffload.h" #include "cffgload.h" +#include FT_INTERNAL_CFF_OBJECTS_TYPES_H #include "cfferrs.h" @@ -143,7 +143,7 @@ FT_Int glyph_index; CFF_Font cff = (CFF_Font)face->other; - PSAux_Service psaux = cff->psaux; + PSAux_Service psaux = (PSAux_Service)face->psaux; const CFF_Decoder_Funcs decoder_funcs = psaux->cff_decoder_funcs; *max_advance = 0; @@ -203,7 +203,7 @@ FT_Bool hinting, scaled, force_scaling; CFF_Font cff = (CFF_Font)face->extra.data; - PSAux_Service psaux = cff->psaux; + PSAux_Service psaux = face->psaux; const CFF_Decoder_Funcs decoder_funcs = psaux->cff_decoder_funcs; FT_Matrix font_matrix; @@ -404,7 +404,7 @@ decoder_funcs->init( &decoder, face, size, glyph, hinting, - FT_LOAD_TARGET_MODE( load_flags ) + FT_LOAD_TARGET_MODE( load_flags ), cff_get_glyph_data, cff_free_glyph_data ); @@ -490,7 +490,7 @@ Glyph_Build_Finished: /* save new glyph tables, if no error */ if ( !error ) - cff_builder_done( &decoder.builder ); + decoder.builder.funcs.done( &decoder.builder ); /* XXX: anything to do for broken glyph entry? */ } diff --git a/src/cff/cffgload.h b/src/cff/cffgload.h index b2e945d03..ed291b87d 100644 --- a/src/cff/cffgload.h +++ b/src/cff/cffgload.h @@ -22,7 +22,7 @@ #include <ft2build.h> #include FT_FREETYPE_H -#include "cffobjs.h" +#include FT_INTERNAL_CFF_OBJECTS_TYPES_H FT_BEGIN_HEADER diff --git a/src/cff/cffload.h b/src/cff/cffload.h index e079cefe3..5e35e4327 100644 --- a/src/cff/cffload.h +++ b/src/cff/cffload.h @@ -21,9 +21,9 @@ #include <ft2build.h> -#include "cfftypes.h" +#include FT_INTERNAL_CFF_TYPES_H #include "cffparse.h" -#include "cffobjs.h" /* for CFF_Face */ +#include FT_INTERNAL_CFF_OBJECTS_TYPES_H /* for CFF_Face */ FT_BEGIN_HEADER diff --git a/src/cff/cffobjs.h b/src/cff/cffobjs.h index 1dba694c5..839a61c44 100644 --- a/src/cff/cffobjs.h +++ b/src/cff/cffobjs.h @@ -21,111 +21,11 @@ #include <ft2build.h> -#include FT_INTERNAL_OBJECTS_H -#include "cfftypes.h" -#include FT_INTERNAL_TRUETYPE_TYPES_H -#include FT_SERVICE_POSTSCRIPT_CMAPS_H -#include FT_INTERNAL_POSTSCRIPT_HINTS_H FT_BEGIN_HEADER - /*************************************************************************/ - /* */ - /* <Type> */ - /* CFF_Driver */ - /* */ - /* <Description> */ - /* A handle to an OpenType driver object. */ - /* */ - typedef struct CFF_DriverRec_* CFF_Driver; - - typedef TT_Face CFF_Face; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* CFF_Size */ - /* */ - /* <Description> */ - /* A handle to an OpenType size object. */ - /* */ - typedef struct CFF_SizeRec_ - { - FT_SizeRec root; - FT_ULong strike_index; /* 0xFFFFFFFF to indicate invalid */ - - } CFF_SizeRec, *CFF_Size; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* CFF_GlyphSlot */ - /* */ - /* <Description> */ - /* A handle to an OpenType glyph slot object. */ - /* */ - typedef struct CFF_GlyphSlotRec_ - { - FT_GlyphSlotRec root; - - FT_Bool hint; - FT_Bool scaled; - - FT_Fixed x_scale; - FT_Fixed y_scale; - - } CFF_GlyphSlotRec, *CFF_GlyphSlot; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* CFF_Internal */ - /* */ - /* <Description> */ - /* The interface to the `internal' field of `FT_Size'. */ - /* */ - typedef struct CFF_InternalRec_ - { - PSH_Globals topfont; - PSH_Globals subfonts[CFF_MAX_CID_FONTS]; - - } CFF_InternalRec, *CFF_Internal; - - - /*************************************************************************/ - /* */ - /* Subglyph transformation record. */ - /* */ - typedef struct CFF_Transform_ - { - FT_Fixed xx, xy; /* transformation matrix coefficients */ - FT_Fixed yx, yy; - FT_F26Dot6 ox, oy; /* offsets */ - - } CFF_Transform; - - - /***********************************************************************/ - /* */ - /* CFF driver class. */ - /* */ - typedef struct CFF_DriverRec_ - { - FT_DriverRec root; - - FT_UInt hinting_engine; - FT_Bool no_stem_darkening; - FT_Int darken_params[8]; - FT_Int32 random_seed; - - } CFF_DriverRec; - - FT_LOCAL( FT_Error ) cff_size_init( FT_Size size ); /* CFF_Size */ diff --git a/src/cff/cffparse.h b/src/cff/cffparse.h index 83d1bba45..961c26501 100644 --- a/src/cff/cffparse.h +++ b/src/cff/cffparse.h @@ -21,7 +21,7 @@ #include <ft2build.h> -#include "cfftypes.h" +#include FT_INTERNAL_CFF_TYPES_H #include FT_INTERNAL_OBJECTS_H diff --git a/src/cff/rules.mk b/src/cff/rules.mk index feecf4611..8cf99b2e2 100644 --- a/src/cff/rules.mk +++ b/src/cff/rules.mk @@ -39,8 +39,7 @@ CFF_DRV_SRC := $(CFF_DIR)/cffcmap.c \ # CFF_DRV_H := $(CFF_DRV_SRC:%.c=%.h) \ $(CFF_DIR)/cfferrs.h \ - $(CFF_DIR)/cfftoken.h \ - $(CFF_DIR)/cfftypes.h + $(CFF_DIR)/cfftoken.h # CFF driver object(s) diff --git a/src/psaux/cf2ft.h b/src/psaux/cf2ft.h index 19644ecec..772fb0710 100644 --- a/src/psaux/cf2ft.h +++ b/src/psaux/cf2ft.h @@ -50,7 +50,7 @@ #include FT_SYSTEM_H #include "cf2glue.h" -#include "psaux.h" /* for CFF_Decoder */ +#include FT_INTERNAL_POSTSCRIPT_AUX_H /* for CFF_Decoder */ FT_BEGIN_HEADER diff --git a/src/psaux/cffdecode.c b/src/psaux/cffdecode.c index 854d651eb..d3af3db45 100644 --- a/src/psaux/cffdecode.c +++ b/src/psaux/cffdecode.c @@ -430,6 +430,8 @@ return -1; } +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + /*************************************************************************/ /* */ /* <Function> */ @@ -2216,6 +2218,8 @@ return FT_THROW( Stack_Overflow ); } +#endif /* CFF_CONFIG_OPTION_OLD_ENGINE */ + /*************************************************************************/ /* */ diff --git a/src/psaux/cffdecode.h b/src/psaux/cffdecode.h index 5542c0927..e70804059 100644 --- a/src/psaux/cffdecode.h +++ b/src/psaux/cffdecode.h @@ -10,16 +10,18 @@ FT_BEGIN_HEADER FT_LOCAL( void ) cff_decoder_init( CFF_Decoder* decoder, - TT_Face face, - CFF_Size size, - CFF_GlyphSlot slot, - FT_Bool hinting, - FT_Render_Mode hint_mode ); + TT_Face face, + CFF_Size size, + CFF_GlyphSlot slot, + FT_Bool hinting, + FT_Render_Mode hint_mode, + CFF_Decoder_Get_Glyph_Callback get_callback, + CFF_Decoder_Free_Glyph_Callback free_callback); FT_LOCAL( FT_Error ) cff_decoder_prepare( CFF_Decoder* decoder, - CFF_Size size, - FT_UInt glyph_index ); + CFF_Size size, + FT_UInt glyph_index ); FT_LOCAL( FT_Int ) @@ -30,9 +32,9 @@ FT_BEGIN_HEADER #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, - FT_Bool in_dict ); + FT_Byte* charstring_base, + FT_ULong charstring_len, + FT_Bool in_dict ); #endif diff --git a/src/psaux/psaux.c b/src/psaux/psaux.c index ffbaec719..f99884afc 100644 --- a/src/psaux/psaux.c +++ b/src/psaux/psaux.c @@ -27,5 +27,15 @@ #include "t1decode.c" #include "cffdecode.c" +#include "cf2arrst.c" +#include "cf2blues.c" +#include "cf2error.c" +#include "cf2font.c" +#include "cf2ft.c" +#include "cf2hints.c" +#include "cf2intrp.c" +#include "cf2read.c" +#include "cf2stack.c" + /* END */ diff --git a/src/psaux/psauxmod.c b/src/psaux/psauxmod.c index a37ac746b..9e6a91557 100644 --- a/src/psaux/psauxmod.c +++ b/src/psaux/psauxmod.c @@ -122,7 +122,7 @@ #endif FT_CALLBACK_TABLE_DEF - const CFF_Decoder_Funcs cff_decoder_funcs = + const CFF_Decoder_FuncsRec cff_decoder_funcs = { cff_decoder_init, /* init */ cff_decoder_prepare, /* prepare */ diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c index 37ea6fe52..2fe55f88a 100644 --- a/src/psaux/psobjs.c +++ b/src/psaux/psobjs.c @@ -20,6 +20,7 @@ #include FT_INTERNAL_POSTSCRIPT_AUX_H #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_CALC_H +#include FT_INTERNAL_CFF_OBJECTS_TYPES_H #include "psobjs.h" #include "psconv.h" @@ -1816,8 +1817,7 @@ if ( hinting && size ) { - FT_Size ftsize = FT_SIZE( size ); - CFF_Internal internal = (CFF_Internal)ftsize->internal->module_data; + CFF_Internal internal = (CFF_Internal)size->root.internal->module_data; if ( internal ) diff --git a/src/psaux/psobjs.h b/src/psaux/psobjs.h index 73cd9054e..c06bb281c 100644 --- a/src/psaux/psobjs.h +++ b/src/psaux/psobjs.h @@ -22,6 +22,7 @@ #include <ft2build.h> #include FT_INTERNAL_POSTSCRIPT_AUX_H +#include FT_INTERNAL_CFF_OBJECTS_TYPES_H FT_BEGIN_HEADER |