diff options
author | David Turner <david@freetype.org> | 2002-02-28 16:10:29 +0000 |
---|---|---|
committer | David Turner <david@freetype.org> | 2002-02-28 16:10:29 +0000 |
commit | aa919383de82099cb3872c3bb16f2068b227f290 (patch) | |
tree | b718d6d48fd9c07ed1b2ffde4e9778b2594ced6c /src/sfnt | |
parent | 77e54f363a73470431e5745e6d696fb097b2ad44 (diff) | |
download | freetype2-aa919383de82099cb3872c3bb16f2068b227f290.tar.gz |
yet another logical transformation of the internals to make them
more consistent and understandable..
mainly, changing things like PS_Table => PS_TableRec + *PS_Table
Diffstat (limited to 'src/sfnt')
-rw-r--r-- | src/sfnt/sfobjs.c | 18 | ||||
-rw-r--r-- | src/sfnt/ttcmap0.c | 186 | ||||
-rw-r--r-- | src/sfnt/ttpost.c | 4 |
3 files changed, 148 insertions, 60 deletions
diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c index d0432a29f..c4e8d9874 100644 --- a/src/sfnt/sfobjs.c +++ b/src/sfnt/sfobjs.c @@ -186,19 +186,19 @@ FT_Int num_params, FT_Parameter* params ) { - FT_Error error; - FT_Library library = face->root.driver->root.library; - SFNT_Interface* sfnt; - SFNT_Header sfnt_header; + FT_Error error; + FT_Library library = face->root.driver->root.library; + SFNT_Service sfnt; + SFNT_Header sfnt_header; /* for now, parameters are unused */ FT_UNUSED( num_params ); FT_UNUSED( params ); - sfnt = (SFNT_Interface*)face->sfnt; + sfnt = (SFNT_Service)face->sfnt; if ( !sfnt ) { - sfnt = (SFNT_Interface*)FT_Get_Module_Interface( library, "sfnt" ); + sfnt = (SFNT_Service)FT_Get_Module_Interface( library, "sfnt" ); if ( !sfnt ) { error = SFNT_Err_Invalid_File_Format; @@ -211,7 +211,7 @@ if ( !face->psnames ) { - face->psnames = (PSNames_Interface*) + face->psnames = (PSNames_Service) FT_Get_Module_Interface( library, "psnames" ); } @@ -253,7 +253,7 @@ FT_Bool has_outline; FT_Bool is_apple_sbit; - SFNT_Interface* sfnt = (SFNT_Interface*)face->sfnt; + SFNT_Service sfnt = (SFNT_Service)face->sfnt; FT_UNUSED( face_index ); FT_UNUSED( num_params ); @@ -596,7 +596,7 @@ SFNT_Done_Face( TT_Face face ) { FT_Memory memory = face->root.memory; - SFNT_Interface* sfnt = (SFNT_Interface*)face->sfnt; + SFNT_Service sfnt = (SFNT_Service)face->sfnt; if ( sfnt ) diff --git a/src/sfnt/ttcmap0.c b/src/sfnt/ttcmap0.c index d416b1b3a..2ac62c4e5 100644 --- a/src/sfnt/ttcmap0.c +++ b/src/sfnt/ttcmap0.c @@ -44,6 +44,35 @@ #define TT_NEXT_Long FT_NEXT_LONG_BE #define TT_NEXT_ULong FT_NEXT_ULONG_BE + + typedef struct TT_CMap_InfoRec_ + { + FT_ByteP base; + FT_ByteP limit; + FT_ValidationLevel level; + + } TT_CMap_InfoRec, *TT_CMap_Info; + + + FT_CALLBACK_DEF FT_Error + tt_cmap_init( FT_CMap cmap, + TT_CMap_Info info ) + { + FT_Error error; + TT_CMap_Class clazz = (TT_CMap_Class) FT_CMAP_CLASS(cmap); + FT_ValidatorRec valid; + + cmap->data = info->base; + + ft_validator_init( &valid, info->base, info->limit, info->level ); + + if ( setjmp( valid->jump_buffer, 0 ) == 0 ) + clazz->validate( info->base, &valid ); + + return valid.error; + } + + /************************************************************************/ /************************************************************************/ /***** *****/ @@ -68,7 +97,7 @@ #ifdef TT_CONFIG_CMAP_FORMAT_0 - static void + FT_CALLBACK_DEF void tt_cmap0_validate( FT_Byte* table, FT_Validator valid ) { @@ -94,7 +123,7 @@ } - static FT_UInt + FT_CALLBACK_DEF FT_UInt tt_cmap0_char_index( FT_Byte* table, FT_ULong char_code ) { @@ -102,7 +131,7 @@ } - static FT_ULong + FT_CALLBACK_DEF FT_ULong tt_cmap0_char_next( FT_Byte* table, FT_ULong char_code, FT_UInt *agindex ) @@ -127,13 +156,22 @@ return result; } - static const TT_Cmap_ClassRec tt_cmap0_class_rec = + + FT_CALLBACK_TABLE const TT_Cmap_ClassRec tt_cmap0_class_rec = { - (TT_CMap_ValidateFunc) tt_cmap0_validate, - (TT_CMap_CharIndexFunc) tt_cmap0_char_index, - (TT_CMap_CharNextFunc) tt_cmap0_char_next + { + sizeof( FT_CMapRec ), + + (FT_CMap_InitFunc) tt_cmap_init, + (FT_CMap_DoneFunc) NULL, + (FT_CMap_CharIndexFunc) tt_cmap0_char_index, + (FT_CMap_CharNextFunc) tt_cmap0_char_next + }, + (TT_CMap_ValidateFunc) tt_cmap0_validate }; + FT_LOCAL_DEF TT_CMap_Class tt_cmap0_class = &tt_cmap0_class_rec; + #endif /* TT_CONFIG_CMAP_FORMAT_0 */ @@ -224,7 +262,7 @@ #ifdef TT_CONFIG_CMAP_FORMAT_2 - static void + FT_CALLBACK_DEF void tt_cmap2_validate( FT_Byte* table, FT_Validator valid ) { @@ -362,7 +400,7 @@ } - static FT_UInt + FT_CALLBACK_DEF FT_UInt tt_cmap2_char_index( FT_Byte* table, FT_ULong char_code ) { @@ -398,7 +436,7 @@ - static FT_UInt + FT_CALLBACK_DEF FT_UInt tt_cmap2_char_next( FT_Byte* table, FT_ULong char_code, FT_UInt *agindex ) @@ -464,13 +502,21 @@ return result; } - static const TT_Cmap_ClassRec tt_cmap2_class_rec = + FT_CALLBACK_TABLE const TT_Cmap_ClassRec tt_cmap2_class_rec = { - (TT_CMap_ValidateFunc) tt_cmap2_validate, - (TT_CMap_CharIndexFunc) tt_cmap2_char_index, - (TT_CMap_CharNextFunc) tt_cmap2_char_next + { + sizeof( FT_CMapRec ), + + (FT_CMap_InitFunc) tt_cmap_init, + (FT_CMap_DoneFunc) NULL, + (FT_CMap_CharIndexFunc) tt_cmap2_char_index, + (FT_CMap_CharNextFunc) tt_cmap2_char_next + }, + (TT_CMap_ValidateFunc) tt_cmap2_validate }; + FT_LOCAL_DEF TT_CMap_Class tt_cmap2_class = &tt_cmap2_class_rec; + #endif /* TT_CONFIG_CMAP_FORMAT_2 */ @@ -536,7 +582,7 @@ #ifdef TT_CONFIG_CMAP_FORMAT_4 - static void + FT_CALLBACK_DEF void tt_cmap4_validate( FT_Byte* table, FT_Validator valid ) { @@ -653,7 +699,7 @@ - static FT_UInt + FT_CALLBACK_DEF FT_UInt tt_cmap4_char_index( FT_Byte* table, FT_ULong char_code ) { @@ -703,7 +749,7 @@ - static FT_ULong + FT_CALLBACK_DEF FT_ULong tt_cmap4_char_next( FT_Byte* table, FT_ULong char_code, FT_UInt *agindex ) @@ -784,13 +830,21 @@ return result; } - static const TT_Cmap_ClassRec tt_cmap4_class_rec = + FT_CALLBACK_TABLE const TT_Cmap_ClassRec tt_cmap4_class_rec = { - (TT_CMap_ValidateFunc) tt_cmap4_validate, - (TT_CMap_CharIndexFunc) tt_cmap4_char_index, - (TT_CMap_CharNextFunc) tt_cmap4_char_next + { + sizeof( FT_CMapRec ), + + (FT_CMap_InitFunc) tt_cmap_init, + (FT_CMap_DoneFunc) NULL, + (FT_CMap_CharIndexFunc) tt_cmap4_char_index, + (FT_CMap_CharNextFunc) tt_cmap4_char_next + }, + (TT_CMap_ValidateFunc) tt_cmap4_validate }; + FT_LOCAL_DEF TT_CMap_Class tt_cmap4_class = &tt_cmap4_class_rec; + #endif /* TT_CONFIG_CMAP_FORMAT_4 */ /************************************************************************/ @@ -822,7 +876,7 @@ #ifdef TT_CONFIG_CMAP_FORMAT_6 - static void + FT_CALLBACK_DEF void tt_cmap6_validate( FT_Byte* table, FT_Validator valid ) { @@ -857,7 +911,7 @@ } - static FT_UInt + FT_CALLBACK_DEF FT_UInt tt_cmap6_char_index( FT_Byte* table, FT_ULong char_code ) { @@ -876,7 +930,7 @@ } - static FT_ULong + FT_CALLBACK_DEF FT_ULong tt_cmap6_char_next( FT_Byte* table, FT_ULong char_code, FT_UInt *agindex ) @@ -916,13 +970,22 @@ return result; } - static const TT_Cmap_ClassRec tt_cmap6_class_rec = + + FT_CALLBACK_TABLE const TT_Cmap_ClassRec tt_cmap6_class_rec = { - (TT_CMap_ValidateFunc) tt_cmap6_validate, - (TT_CMap_CharIndexFunc) tt_cmap6_char_index, - (TT_CMap_CharNextFunc) tt_cmap6_char_next + { + sizeof( FT_CMapRec ), + + (FT_CMap_InitFunc) tt_cmap_init, + (FT_CMap_DoneFunc) NULL, + (FT_CMap_CharIndexFunc) tt_cmap6_char_index, + (FT_CMap_CharNextFunc) tt_cmap6_char_next + }, + (TT_CMap_ValidateFunc) tt_cmap6_validate }; + FT_LOCAL_DEF TT_CMap_Class tt_cmap6_class = &tt_cmap6_class_rec; + #endif /* TT_CONFIG_CMAP_FORMAT_6 */ @@ -985,7 +1048,7 @@ #ifdef TT_CONFIG_CMAP_FORMAT_8 - static void + FT_CALLBACK_DEF void tt_cmap8_validate( FT_Byte* table, FT_Validator valid ) { @@ -1075,7 +1138,7 @@ } - static FT_UInt + FT_CALLBACK_DEF FT_UInt tt_cmap8_char_index( FT_Byte* table, FT_ULong char_code ) { @@ -1103,7 +1166,7 @@ } - static FT_ULong + FT_CALLBACK_DEF FT_ULong tt_cmap8_char_next( FT_Byte* table, FT_ULong char_code, FT_UInt *agindex ) @@ -1145,13 +1208,21 @@ } - static const TT_Cmap_ClassRec tt_cmap8_class_rec = + FT_CALLBACK_TABLE const TT_Cmap_ClassRec tt_cmap8_class_rec = { - (TT_CMap_ValidateFunc) tt_cmap8_validate, - (TT_CMap_CharIndexFunc) tt_cmap8_char_index, - (TT_CMap_CharNextFunc) tt_cmap8_char_next + { + sizeof( FT_CMapRec ), + + (FT_CMap_InitFunc) tt_cmap_init, + (FT_CMap_DoneFunc) NULL, + (FT_CMap_CharIndexFunc) tt_cmap8_char_index, + (FT_CMap_CharNextFunc) tt_cmap8_char_next + }, + (TT_CMap_ValidateFunc) tt_cmap8_validate }; + FT_LOCAL_DEF TT_CMap_Class tt_cmap8_class = &tt_cmap8_class_rec; + #endif /* TT_CONFIG_CMAP_FORMAT_8 */ /************************************************************************/ @@ -1181,7 +1252,7 @@ #ifdef TT_CONFIG_CMAP_FORMAT_10 - static void + FT_CALLBACK_DEF void tt_cmap10_validate( FT_Byte* table, FT_Validator valid ) { @@ -1214,7 +1285,7 @@ } - static FT_UInt + FT_CALLBACK_DEF FT_UInt tt_cmap10_char_index( FT_Byte* table, FT_ULong char_code ) { @@ -1233,7 +1304,7 @@ } - static FT_ULong + FT_CALLBACK_DEF FT_ULong tt_cmap10_char_next( FT_Byte* table, FT_ULong char_code, FT_UInt *agindex ) @@ -1270,13 +1341,22 @@ return result; } - static const TT_Cmap_ClassRec tt_cmap10_class_rec = + + FT_CALLBACK_TABLE const TT_Cmap_ClassRec tt_cmap10_class_rec = { - (TT_CMap_ValidateFunc) tt_cmap10_validate, - (TT_CMap_CharIndexFunc) tt_cmap10_char_index, - (TT_CMap_CharNextFunc) tt_cmap10_char_next + { + sizeof( FT_CMapRec ), + + (FT_CMap_InitFunc) tt_cmap_init, + (FT_CMap_DoneFunc) NULL, + (FT_CMap_CharIndexFunc) tt_cmap10_char_index, + (FT_CMap_CharNextFunc) tt_cmap10_char_next + }, + (TT_CMap_ValidateFunc) tt_cmap10_validate }; + FT_LOCAL_DEF TT_CMap_Class tt_cmap10_class = &tt_cmap10_class_rec; + #endif /* TT_CONFIG_CMAP_FORMAT_10 */ @@ -1312,7 +1392,7 @@ #ifdef TT_CONFIG_CMAP_FORMAT_12 - static void + FT_CALLBACK_DEF void tt_cmap12_validate( FT_Byte* table, FT_Validator valid ) { @@ -1364,7 +1444,7 @@ - static FT_UInt + FT_CALLBACK_DEF FT_UInt tt_cmap12_char_index( FT_Byte* table, FT_ULong char_code ) { @@ -1392,7 +1472,7 @@ } - static FT_ULong + FT_CALLBACK_DEF FT_ULong tt_cmap12_char_next( FT_Byte* table, FT_ULong char_code, FT_UInt *agindex ) @@ -1434,13 +1514,21 @@ } - static const TT_Cmap_ClassRec tt_cmap12_class_rec = + FT_CALLBACK_TABLE const TT_Cmap_ClassRec tt_cmap12_class_rec = { - (TT_CMap_ValidateFunc) tt_cmap12_validate, - (TT_CMap_CharIndexFunc) tt_cmap12_char_index, - (TT_CMap_CharNextFunc) tt_cmap12_char_next + { + sizeof( FT_CMapRec ), + + (FT_CMap_InitFunc) tt_cmap_init, + (FT_CMap_DoneFunc) NULL, + (FT_CMap_CharIndexFunc) tt_cmap12_char_index, + (FT_CMap_CharNextFunc) tt_cmap12_char_next + }, + (TT_CMap_ValidateFunc) tt_cmap12_validate }; + FT_LOCAL_DEF TT_CMap_Class tt_cmap12_class = &tt_cmap12_class_rec; + #endif /* TT_CONFIG_CMAP_FORMAT_12 */ /* END */ diff --git a/src/sfnt/ttpost.c b/src/sfnt/ttpost.c index c22870692..6942ff4a1 100644 --- a/src/sfnt/ttpost.c +++ b/src/sfnt/ttpost.c @@ -450,7 +450,7 @@ TT_Post_Names* names; #ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES - PSNames_Interface* psnames; + PSNames_Service psnames; #endif @@ -461,7 +461,7 @@ return SFNT_Err_Invalid_Glyph_Index; #ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES - psnames = (PSNames_Interface*)face->psnames; + psnames = (PSNames_Service)face->psnames; if ( !psnames ) return SFNT_Err_Unimplemented_Feature; #endif |