diff --git a/src/shared/t1types.h b/src/shared/t1types.h index 9d74ebec9..cdcfd8897 100644 --- a/src/shared/t1types.h +++ b/src/shared/t1types.h @@ -21,7 +21,7 @@ #ifndef T1TYPES_H #define T1TYPES_H -#include +#include #include #ifdef __cplusplus @@ -310,55 +310,12 @@ { /* font info dictionary */ + T1_FontInfo font_info; - T1_String* version; - T1_String* notice; - T1_String* full_name; - T1_String* family_name; - T1_String* weight; - T1_Long italic_angle; - T1_Bool is_fixed_pitch; - T1_Short underline_position; - T1_UShort underline_thickness; - /* private dictionary */ - - T1_Int unique_id; - T1_Int lenIV; - - T1_Byte num_blues; - T1_Byte num_other_blues; - T1_Byte num_family_blues; - T1_Byte num_family_other_blues; - - T1_Short blue_values[14]; - T1_Short other_blues[10]; - - T1_Short family_blues [14]; - T1_Short family_other_blues[10]; - - T1_Fixed blue_scale; - T1_Int blue_shift; - T1_Int blue_fuzz; - - T1_UShort standard_width; - T1_UShort standard_height; - - T1_Byte num_snap_widths; - T1_Byte num_snap_heights; - T1_Bool force_bold; - T1_Bool round_stem_up; - - T1_Short stem_snap_widths [13]; /* reserve one place for the std */ - T1_Short stem_snap_heights[13]; /* reserve one place for the std */ - - T1_Long language_group; - T1_Long password; - - T1_Short min_feature[2]; + T1_Private private_dict; /* top-level dictionary */ - FT_String* font_name; T1_EncodingType encoding_type; diff --git a/src/shared/tttypes.h b/src/shared/tttypes.h index 74a8c4364..29136fed8 100644 --- a/src/shared/tttypes.h +++ b/src/shared/tttypes.h @@ -788,60 +788,6 @@ /* load them by default. See the ttpost.c file. */ } TT_Postscript; -#endif - - /*************************************************************************/ - /* */ - /* */ - /* TT_CMapDir */ - /* */ - /* */ - /* This structure describes the directory of the `cmap' table, */ - /* containing the font's character mappings table. */ - /* */ - /* */ - /* tableVersionNumber :: The version number. */ - /* numCMaps :: The number of charmaps in the font. */ - /* */ - /* */ - /* This structure is only used during font loading. */ - /* */ - typedef struct TT_CMapDir_ - { - TT_UShort tableVersionNumber; - TT_UShort numCMaps; - - } TT_CMapDir; - - - /*************************************************************************/ - /* */ - /* */ - /* TT_CMapDirEntry */ - /* */ - /* */ - /* This structure describes a charmap in a TrueType font. */ - /* */ - /* */ - /* platformID :: An ID used to specify for which platform this */ - /* charmap is defined (FreeType manages all platforms). */ - /* */ - /* encodingID :: A platform-specific ID used to indicate which source */ - /* encoding is used in this charmap. */ - /* */ - /* offset :: The offset of the charmap relative to the start of */ - /* the `cmap' table. */ - /* */ - /* */ - /* This structure is only used during font loading. */ - /* */ - typedef struct TT_CMapDirEntry_ - { - TT_UShort platformID; - TT_UShort platformEncodingID; - TT_Long offset; - - } TT_CMapDirEntry; /*************************************************************************/ @@ -932,6 +878,62 @@ } TT_MaxProfile; +#endif + + /*************************************************************************/ + /* */ + /* */ + /* TT_CMapDir */ + /* */ + /* */ + /* This structure describes the directory of the `cmap' table, */ + /* containing the font's character mappings table. */ + /* */ + /* */ + /* tableVersionNumber :: The version number. */ + /* numCMaps :: The number of charmaps in the font. */ + /* */ + /* */ + /* This structure is only used during font loading. */ + /* */ + typedef struct TT_CMapDir_ + { + TT_UShort tableVersionNumber; + TT_UShort numCMaps; + + } TT_CMapDir; + + + /*************************************************************************/ + /* */ + /* */ + /* TT_CMapDirEntry */ + /* */ + /* */ + /* This structure describes a charmap in a TrueType font. */ + /* */ + /* */ + /* platformID :: An ID used to specify for which platform this */ + /* charmap is defined (FreeType manages all platforms). */ + /* */ + /* encodingID :: A platform-specific ID used to indicate which source */ + /* encoding is used in this charmap. */ + /* */ + /* offset :: The offset of the charmap relative to the start of */ + /* the `cmap' table. */ + /* */ + /* */ + /* This structure is only used during font loading. */ + /* */ + typedef struct TT_CMapDirEntry_ + { + TT_UShort platformID; + TT_UShort platformEncodingID; + TT_Long offset; + + } TT_CMapDirEntry; + + /*************************************************************************/ /* */ /* */ diff --git a/src/type1/t1hinter.c b/src/type1/t1hinter.c index bb2f2355f..3a09ed7a5 100644 --- a/src/type1/t1hinter.c +++ b/src/type1/t1hinter.c @@ -105,7 +105,7 @@ T1_Error t1_set_blue_zones( T1_Size size ) { T1_Face face = (T1_Face)size->root.face; - T1_Font* priv = &face->type1; + T1_Private* priv = &face->type1.private_dict; T1_Int n; T1_Int blues[24]; T1_Int num_bottom; @@ -286,7 +286,7 @@ T1_Fixed scale; T1_Face face = (T1_Face)size->root.face; - T1_Font* priv = &face->type1; + T1_Private* priv = &face->type1.private_dict; T1_Size_Hints* hints = size->hints; /* start with horizontal snap zones */ @@ -1286,7 +1286,7 @@ void T1_Hint_Stems( T1_Builder* builder ) { T1_Glyph_Hints* hints = builder->glyph->hints; - T1_Font* priv = &builder->face->type1; + T1_Private* priv = &builder->face->type1.private_dict; T1_Size size = builder->size; T1_Fixed scale_x = size->root.metrics.x_scale; diff --git a/src/type1/t1load.c b/src/type1/t1load.c index 3c2e5c2f7..87c2d1fee 100644 --- a/src/type1/t1load.c +++ b/src/type1/t1load.c @@ -44,7 +44,7 @@ parser->encoding_lengths = 0; parser->dump_tokens = 0; - face->type1.lenIV = 4; /* XXX : is it sure ?? */ + face->type1.private_dict.lenIV = 4; /* XXX : is it sure ?? */ } @@ -309,7 +309,7 @@ break; case imm_UniqueID: - type1->unique_id = CopyInteger( parser ); + type1->private_dict.unique_id = CopyInteger( parser ); break; case imm_StrokeWidth: @@ -347,8 +347,8 @@ static T1_Error Do_Def_FontInfo( T1_Parser* parser ) { - T1_Token* top = parser->top; - T1_Font* info = &parser->face->type1; + T1_Token* top = parser->top; + T1_FontInfo* info = &parser->face->type1.font_info; switch ( top[0].kind2 ) { @@ -416,7 +416,7 @@ T1_Error Do_Def_Private( T1_Parser* parser ) { T1_Token* top = parser->top; - T1_Font* priv = &parser->face->type1; + T1_Private* priv = &parser->face->type1.private_dict; switch ( top[0].kind2 ) { @@ -722,8 +722,8 @@ t1_decrypt( base, count, 4330 ); tokzer->cursor += count; - base += face->type1.lenIV; - count -= face->type1.lenIV; + base += face->type1.private_dict.lenIV; + count -= face->type1.private_dict.lenIV; error = T1_Add_Table( &parser->table, index, base, count ); } @@ -806,8 +806,8 @@ t1_decrypt( base, count, 4330 ); tokzer->cursor += count; /* skip */ - base += face->type1.lenIV; - count -= face->type1.lenIV; + base += face->type1.private_dict.lenIV; + count -= face->type1.private_dict.lenIV; error = T1_Add_Table( &parser->table, index*2+1, base, count ); } diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c index c5ba417f4..7bd19dc81 100644 --- a/src/type1/t1objs.c +++ b/src/type1/t1objs.c @@ -243,17 +243,17 @@ root->face_flags |= FT_FACE_FLAG_HORIZONTAL; - if ( type1->is_fixed_pitch ) + if ( type1->font_info.is_fixed_pitch ) root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH; /* XXX : TO DO - add kerning with .afm support */ /* get style name - be careful, some broken fonts only */ /* have a /FontName dictionary entry .. !! */ - root->family_name = type1->family_name; + root->family_name = type1->font_info.family_name; if (root->family_name) { - char* full = type1->full_name; + char* full = type1->font_info.full_name; char* family = root->family_name; while ( *family && *full == *family ) @@ -286,10 +286,10 @@ /* now compute the maximum advance width */ - root->max_advance_width = type1->standard_width; + root->max_advance_width = type1->private_dict.standard_width; /* compute max advance width for proportional fonts */ - if (!type1->is_fixed_pitch) + if (!type1->font_info.is_fixed_pitch) { T1_Int max_advance; @@ -304,8 +304,8 @@ root->max_advance_height = root->height; - root->underline_position = type1->underline_position; - root->underline_thickness = type1->underline_thickness; + root->underline_position = type1->font_info.underline_position; + root->underline_thickness = type1->font_info.underline_thickness; root->max_points = 0; root->max_contours = 0; diff --git a/src/type1z/t1load.c b/src/type1z/t1load.c index d272e4e59..5877b8660 100644 --- a/src/type1z/t1load.c +++ b/src/type1z/t1load.c @@ -437,8 +437,8 @@ if (!read_binary_data(parser,&size,&base)) return; T1_Decrypt( base, size, 4330 ); - size -= face->type1.lenIV; - base += face->type1.lenIV; + size -= face->type1.private_dict.lenIV; + base += face->type1.private_dict.lenIV; error = T1_Add_Table( table, index, base, size ); if (error) goto Fail; @@ -521,8 +521,8 @@ if (!read_binary_data(parser,&size,&base)) return; T1_Decrypt( base, size, 4330 ); - size -= face->type1.lenIV; - base += face->type1.lenIV; + size -= face->type1.private_dict.lenIV; + base += face->type1.private_dict.lenIV; error = T1_Add_Table( code_table, n, base, size ); if (error) goto Fail; @@ -688,7 +688,7 @@ t1_init_loader( &loader, face ); /* default lenIV */ - type1->lenIV = 4; + type1->private_dict.lenIV = 4; parser = &loader.parser; error = T1_New_Parser( parser, face->root.stream, face->root.memory ); diff --git a/src/type1z/t1objs.c b/src/type1z/t1objs.c index d46d709e7..860f7f4a4 100644 --- a/src/type1z/t1objs.c +++ b/src/type1z/t1objs.c @@ -215,17 +215,17 @@ root->face_flags |= FT_FACE_FLAG_HORIZONTAL; - if ( face->type1.is_fixed_pitch ) + if ( face->type1.font_info.is_fixed_pitch ) root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH; /* XXX : TO DO - add kerning with .afm support */ /* get style name - be careful, some broken fonts only */ /* have a /FontName dictionary entry .. !! */ - root->family_name = face->type1.family_name; + root->family_name = face->type1.font_info.family_name; if (root->family_name) { - char* full = face->type1.full_name; + char* full = face->type1.font_info.full_name; char* family = root->family_name; while ( *family && *full == *family ) @@ -258,10 +258,10 @@ /* now compute the maximum advance width */ - root->max_advance_width = face->type1.standard_width; + root->max_advance_width = face->type1.private_dict.standard_width; /* compute max advance width for proportional fonts */ - if (!face->type1.is_fixed_pitch) + if (!face->type1.font_info.is_fixed_pitch) { T1_Int max_advance; @@ -276,8 +276,8 @@ root->max_advance_height = root->height; - root->underline_position = face->type1.underline_position; - root->underline_thickness = face->type1.underline_thickness; + root->underline_position = face->type1.font_info.underline_position; + root->underline_thickness = face->type1.font_info.underline_thickness; root->max_points = 0; root->max_contours = 0; diff --git a/src/type1z/t1tokens.h b/src/type1z/t1tokens.h index 94de2e27e..0de85beec 100644 --- a/src/type1z/t1tokens.h +++ b/src/type1z/t1tokens.h @@ -17,10 +17,9 @@ * ******************************************************************/ -#undef FACE -#define FACE (face->type1) - /* define the font info dictionary parsing callbacks */ +#undef FACE +#define FACE (face->type1.font_info) PARSE_STRING("version",version) PARSE_STRING("Notice",notice) @@ -35,6 +34,9 @@ /* define the private dict parsing callbacks */ +#undef FACE +#define FACE (face->type1.private_dict) + PARSE_INT("UniqueID",unique_id) PARSE_INT("lenIV",lenIV) @@ -60,6 +62,10 @@ PARSE_COORDS2( "MinFeature", 2, min_feature ) /* define the top-level dictionary parsing callbacks */ + +#undef FACE +#define FACE (face->type1) + /* PARSE_STRING( "FontName", font_name ) -- handled by special routine */ PARSE_NUM( "PaintType", paint_type, T1_Byte )