diff options
author | scuri <scuri> | 2009-10-20 17:20:18 +0000 |
---|---|---|
committer | scuri <scuri> | 2009-10-20 17:20:18 +0000 |
commit | 27a4f9c4ac45ff65f941964f7351b64b1e6a9f35 (patch) | |
tree | 2f68c5d9ce5bf6cbc320ac17aef0a65a3ceb99a1 /src/freetype2/type42 | |
parent | 2b70507615b2611fce4294c65bec7264644e2665 (diff) |
*** empty log message ***
Diffstat (limited to 'src/freetype2/type42')
-rw-r--r-- | src/freetype2/type42/t42drivr.c | 56 | ||||
-rw-r--r-- | src/freetype2/type42/t42drivr.h | 4 | ||||
-rw-r--r-- | src/freetype2/type42/t42objs.c | 89 | ||||
-rw-r--r-- | src/freetype2/type42/t42parse.c | 45 | ||||
-rw-r--r-- | src/freetype2/type42/t42types.h | 6 |
5 files changed, 116 insertions, 84 deletions
diff --git a/src/freetype2/type42/t42drivr.c b/src/freetype2/type42/t42drivr.c index a6e4cf4..820c679 100644 --- a/src/freetype2/type42/t42drivr.c +++ b/src/freetype2/type42/t42drivr.c @@ -4,7 +4,7 @@ /* */ /* High-level Type 42 driver interface (body). */ /* */ -/* Copyright 2002, 2003, 2004, 2006, 2007 by Roberto Alameda. */ +/* Copyright 2002, 2003, 2004, 2006, 2007, 2009 by Roberto Alameda. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ @@ -49,11 +49,11 @@ #define FT_COMPONENT trace_t42 - /* - * - * GLYPH DICT SERVICE - * - */ + /* + * + * GLYPH DICT SERVICE + * + */ static FT_Error t42_get_glyph_name( T42_Face face, @@ -94,11 +94,11 @@ }; - /* - * - * POSTSCRIPT NAME SERVICE - * - */ + /* + * + * POSTSCRIPT NAME SERVICE + * + */ static const char* t42_get_ps_font_name( T42_Face face ) @@ -113,17 +113,28 @@ }; - /* - * - * POSTSCRIPT INFO SERVICE - * - */ + /* + * + * POSTSCRIPT INFO SERVICE + * + */ static FT_Error t42_ps_get_font_info( FT_Face face, PS_FontInfoRec* afont_info ) { *afont_info = ((T42_Face)face)->type1.font_info; + + return T42_Err_Ok; + } + + + static FT_Error + t42_ps_get_font_extra( FT_Face face, + PS_FontExtraRec* afont_extra ) + { + *afont_extra = ((T42_Face)face)->type1.font_extra; + return T42_Err_Ok; } @@ -132,6 +143,7 @@ t42_ps_has_glyph_names( FT_Face face ) { FT_UNUSED( face ); + return 1; } @@ -141,6 +153,7 @@ PS_PrivateRec* afont_private ) { *afont_private = ((T42_Face)face)->type1.private_dict; + return T42_Err_Ok; } @@ -148,16 +161,17 @@ static const FT_Service_PsInfoRec t42_service_ps_info = { (PS_GetFontInfoFunc) t42_ps_get_font_info, + (PS_GetFontExtraFunc) t42_ps_get_font_extra, (PS_HasGlyphNamesFunc) t42_ps_has_glyph_names, (PS_GetFontPrivateFunc)t42_ps_get_font_private }; - /* - * - * SERVICE LIST - * - */ + /* + * + * SERVICE LIST + * + */ static const FT_ServiceDescRec t42_services[] = { diff --git a/src/freetype2/type42/t42drivr.h b/src/freetype2/type42/t42drivr.h index 98b7410..4717e46 100644 --- a/src/freetype2/type42/t42drivr.h +++ b/src/freetype2/type42/t42drivr.h @@ -25,6 +25,10 @@ FT_BEGIN_HEADER +#ifdef FT_CONFIG_OPTION_PIC +#error "this module does not support PIC yet" +#endif + FT_EXPORT_VAR( const FT_Driver_ClassRec ) t42_driver_class; diff --git a/src/freetype2/type42/t42objs.c b/src/freetype2/type42/t42objs.c index db04fde..9081ffc 100644 --- a/src/freetype2/type42/t42objs.c +++ b/src/freetype2/type42/t42objs.c @@ -4,7 +4,8 @@ /* */ /* Type 42 objects manager (body). */ /* */ -/* Copyright 2002, 2003, 2004, 2005, 2006, 2007 by Roberto Alameda. */ +/* Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 */ +/* by Roberto Alameda. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ @@ -19,7 +20,6 @@ #include "t42parse.h" #include "t42error.h" #include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_STREAM_H #include FT_LIST_H @@ -70,7 +70,7 @@ if ( !loader.charstrings.init ) { - FT_ERROR(( "T42_Open_Face: no charstrings array in face!\n" )); + FT_ERROR(( "T42_Open_Face: no charstrings array in face\n" )); error = T42_Err_Invalid_File_Format; } @@ -100,8 +100,8 @@ /* The index is then stored in type1.encoding.char_index, and */ /* the name in type1.encoding.char_name */ - min_char = +32000; - max_char = -32000; + min_char = 0; + max_char = 0; charcode = 0; for ( ; charcode < loader.encoding_table.max_elems; charcode++ ) @@ -127,13 +127,14 @@ { if ( charcode < min_char ) min_char = charcode; - if ( charcode > max_char ) - max_char = charcode; + if ( charcode >= max_char ) + max_char = charcode + 1; } break; } } } + type1->encoding.code_first = min_char; type1->encoding.code_last = max_char; type1->encoding.num_chars = loader.num_chars; @@ -188,7 +189,7 @@ goto Exit; /* check the face index */ - if ( face_index != 0 ) + if ( face_index > 0 ) { FT_ERROR(( "T42_Face_Init: invalid face index\n" )); error = T42_Err_Invalid_Argument; @@ -202,7 +203,7 @@ root->num_glyphs = type1->num_glyphs; root->num_charmaps = 0; - root->face_index = face_index; + root->face_index = 0; root->face_flags = FT_FACE_FLAG_SCALABLE | FT_FACE_FLAG_HORIZONTAL | @@ -328,7 +329,7 @@ charmap.face = root; - /* first of all, try to synthetize a Unicode charmap */ + /* first of all, try to synthesize a Unicode charmap */ charmap.platform_id = 3; charmap.encoding_id = 1; charmap.encoding = FT_ENCODING_UNICODE; @@ -392,50 +393,50 @@ FT_Memory memory; - if ( face ) - { - type1 = &face->type1; - info = &type1->font_info; - memory = face->root.memory; + if ( !face ) + return; - /* delete internal ttf face prior to freeing face->ttf_data */ - if ( face->ttf_face ) - FT_Done_Face( face->ttf_face ); + type1 = &face->type1; + info = &type1->font_info; + memory = face->root.memory; - /* release font info strings */ - FT_FREE( info->version ); - FT_FREE( info->notice ); - FT_FREE( info->full_name ); - FT_FREE( info->family_name ); - FT_FREE( info->weight ); + /* delete internal ttf face prior to freeing face->ttf_data */ + if ( face->ttf_face ) + FT_Done_Face( face->ttf_face ); - /* release top dictionary */ - FT_FREE( type1->charstrings_len ); - FT_FREE( type1->charstrings ); - FT_FREE( type1->glyph_names ); + /* release font info strings */ + FT_FREE( info->version ); + FT_FREE( info->notice ); + FT_FREE( info->full_name ); + FT_FREE( info->family_name ); + FT_FREE( info->weight ); - FT_FREE( type1->charstrings_block ); - FT_FREE( type1->glyph_names_block ); + /* release top dictionary */ + FT_FREE( type1->charstrings_len ); + FT_FREE( type1->charstrings ); + FT_FREE( type1->glyph_names ); - FT_FREE( type1->encoding.char_index ); - FT_FREE( type1->encoding.char_name ); - FT_FREE( type1->font_name ); + FT_FREE( type1->charstrings_block ); + FT_FREE( type1->glyph_names_block ); - FT_FREE( face->ttf_data ); + FT_FREE( type1->encoding.char_index ); + FT_FREE( type1->encoding.char_name ); + FT_FREE( type1->font_name ); + + FT_FREE( face->ttf_data ); #if 0 - /* release afm data if present */ - if ( face->afm_data ) - T1_Done_AFM( memory, (T1_AFM*)face->afm_data ); + /* release afm data if present */ + if ( face->afm_data ) + T1_Done_AFM( memory, (T1_AFM*)face->afm_data ); #endif - /* release unicode map, if any */ - FT_FREE( face->unicode_map.maps ); - face->unicode_map.num_maps = 0; + /* release unicode map, if any */ + FT_FREE( face->unicode_map.maps ); + face->unicode_map.num_maps = 0; - face->root.family_name = 0; - face->root.style_name = 0; - } + face->root.family_name = 0; + face->root.style_name = 0; } @@ -519,7 +520,7 @@ FT_Activate_Size( size->ttsize ); - error = FT_Select_Size( face->ttf_face, strike_index ); + error = FT_Select_Size( face->ttf_face, (FT_Int)strike_index ); if ( !error ) ( (FT_Size)size )->metrics = face->ttf_face->size->metrics; diff --git a/src/freetype2/type42/t42parse.c b/src/freetype2/type42/t42parse.c index 7148379..13bda64 100644 --- a/src/freetype2/type42/t42parse.c +++ b/src/freetype2/type42/t42parse.c @@ -4,7 +4,8 @@ /* */ /* Type 42 font parser (body). */ /* */ -/* Copyright 2002, 2003, 2004, 2005, 2006, 2007 by Roberto Alameda. */ +/* Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */ +/* Roberto Alameda. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ @@ -19,7 +20,6 @@ #include "t42error.h" #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_STREAM_H -#include FT_LIST_H #include FT_INTERNAL_POSTSCRIPT_AUX_H @@ -70,6 +70,13 @@ T1_FIELD_NUM ( "UnderlineThickness", underline_thickness, 0 ) #undef FT_STRUCTURE +#define FT_STRUCTURE PS_FontExtraRec +#undef T1CODE +#define T1CODE T1_FIELD_LOCATION_FONT_EXTRA + + T1_FIELD_NUM ( "FSType", fs_type, 0 ) + +#undef FT_STRUCTURE #define FT_STRUCTURE T1_FontRec #undef T1CODE #define T1CODE T1_FIELD_LOCATION_FONT_DICT @@ -296,7 +303,7 @@ cur = parser->root.cursor; if ( cur >= limit ) { - FT_ERROR(( "t42_parse_encoding: out of bounds!\n" )); + FT_ERROR(( "t42_parse_encoding: out of bounds\n" )); parser->root.error = T42_Err_Invalid_File_Format; return; } @@ -464,14 +471,14 @@ else { - FT_ERROR(( "t42_parse_encoding: invalid token!\n" )); + FT_ERROR(( "t42_parse_encoding: invalid token\n" )); parser->root.error = T42_Err_Invalid_File_Format; } } } - typedef enum + typedef enum T42_Load_Status_ { BEFORE_START, BEFORE_TABLE_DIR, @@ -517,7 +524,7 @@ if ( parser->root.cursor >= limit || *parser->root.cursor++ != '[' ) { - FT_ERROR(( "t42_parse_sfnts: can't find begin of sfnts vector!\n" )); + FT_ERROR(( "t42_parse_sfnts: can't find begin of sfnts vector\n" )); error = T42_Err_Invalid_File_Format; goto Fail; } @@ -562,7 +569,7 @@ if ( allocated ) { FT_ERROR(( "t42_parse_sfnts: " - "can't handle mixed binary and hex strings!\n" )); + "can't handle mixed binary and hex strings\n" )); error = T42_Err_Invalid_File_Format; goto Fail; } @@ -578,7 +585,7 @@ parser->root.cursor += string_size + 1; if ( parser->root.cursor >= limit ) { - FT_ERROR(( "t42_parse_sfnts: too many binary data!\n" )); + FT_ERROR(( "t42_parse_sfnts: too many binary data\n" )); error = T42_Err_Invalid_File_Format; goto Fail; } @@ -586,7 +593,7 @@ if ( !string_buf ) { - FT_ERROR(( "t42_parse_sfnts: invalid data in sfnts array!\n" )); + FT_ERROR(( "t42_parse_sfnts: invalid data in sfnts array\n" )); error = T42_Err_Invalid_File_Format; goto Fail; } @@ -597,7 +604,7 @@ if ( !string_size ) { - FT_ERROR(( "t42_parse_sfnts: invalid string!\n" )); + FT_ERROR(( "t42_parse_sfnts: invalid string\n" )); error = T42_Err_Invalid_File_Format; goto Fail; } @@ -662,7 +669,7 @@ /* all other tables are just copied */ if ( count >= ttf_size ) { - FT_ERROR(( "t42_parse_sfnts: too many binary data!\n" )); + FT_ERROR(( "t42_parse_sfnts: too many binary data\n" )); error = T42_Err_Invalid_File_Format; goto Fail; } @@ -709,7 +716,7 @@ if ( parser->root.cursor >= limit ) { - FT_ERROR(( "t42_parse_charstrings: out of bounds!\n" )); + FT_ERROR(( "t42_parse_charstrings: out of bounds\n" )); error = T42_Err_Invalid_File_Format; goto Fail; } @@ -751,14 +758,14 @@ } else { - FT_ERROR(( "t42_parse_charstrings: invalid token!\n" )); + FT_ERROR(( "t42_parse_charstrings: invalid token\n" )); error = T42_Err_Invalid_File_Format; goto Fail; } if ( parser->root.cursor >= limit ) { - FT_ERROR(( "t42_parse_charstrings: out of bounds!\n" )); + FT_ERROR(( "t42_parse_charstrings: out of bounds\n" )); error = T42_Err_Invalid_File_Format; goto Fail; } @@ -818,7 +825,7 @@ if ( cur + 1 >= limit ) { - FT_ERROR(( "t42_parse_charstrings: out of bounds!\n" )); + FT_ERROR(( "t42_parse_charstrings: out of bounds\n" )); error = T42_Err_Invalid_File_Format; goto Fail; } @@ -849,7 +856,7 @@ (void)T1_ToInt( parser ); if ( parser->root.cursor >= limit ) { - FT_ERROR(( "t42_parse_charstrings: out of bounds!\n" )); + FT_ERROR(( "t42_parse_charstrings: out of bounds\n" )); error = T42_Err_Invalid_File_Format; goto Fail; } @@ -872,7 +879,7 @@ if ( !notdef_found ) { - FT_ERROR(( "t42_parse_charstrings: no /.notdef glyph!\n" )); + FT_ERROR(( "t42_parse_charstrings: no /.notdef glyph\n" )); error = T42_Err_Invalid_File_Format; goto Fail; } @@ -976,6 +983,10 @@ dummy_object = &face->type1.font_info; break; + case T1_FIELD_LOCATION_FONT_EXTRA: + dummy_object = &face->type1.font_extra; + break; + case T1_FIELD_LOCATION_BBOX: dummy_object = &face->type1.font_bbox; break; diff --git a/src/freetype2/type42/t42types.h b/src/freetype2/type42/t42types.h index 6626b04..c7c2db4 100644 --- a/src/freetype2/type42/t42types.h +++ b/src/freetype2/type42/t42types.h @@ -4,7 +4,7 @@ /* */ /* Type 42 font data types (specification only). */ /* */ -/* Copyright 2002, 2003, 2006 by Roberto Alameda. */ +/* Copyright 2002, 2003, 2006, 2008 by Roberto Alameda. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ @@ -35,7 +35,9 @@ FT_BEGIN_HEADER T1_FontRec type1; const void* psnames; const void* psaux; +#if 0 const void* afm_data; +#endif FT_Byte* ttf_data; FT_ULong ttf_size; FT_Face ttf_face; @@ -48,7 +50,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* __T1TYPES_H__ */ +#endif /* __T42TYPES_H__ */ /* END */ |