diff --git a/ChangeLog b/ChangeLog index b1cd95e8b..c5286de8d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2003-09-30 Werner Lemberg + + * src/cid/cidload.c (cid_parse_dict): Skip token if no keyword is + found. + + * src/type1/t1parse.c (IS_T1_WHITESPACE, IS_T1_LINESPACE, + IS_T1_SPACE): Removed. + (PFB_Tag): Removed. + (read_pfb_tag): Don't use PFB_Tag. + + * src/type42/t42parse.c (t42_is_space): Handle `\f' also. + (t42_parse_encoding): Handle synthetic fonts. + 2003-09-29 Werner Lemberg * include/freetype/internal/t1types.h: Don't include diff --git a/src/cid/cidload.c b/src/cid/cidload.c index 7b0aba6af..32c4a0d8d 100644 --- a/src/cid/cidload.c +++ b/src/cid/cidload.c @@ -191,7 +191,7 @@ offset->y = temp[5] >> 16; } - return CID_Err_Ok; /* this is a callback function; */ + return CID_Err_Ok; /* this is a callback function; */ /* we must return an error code */ } @@ -265,7 +265,7 @@ FT_Byte* limit = cur + size; - for ( ;cur < limit; cur++ ) + for ( ; cur < limit; cur++ ) { /* look for `%ADOBeginFontDict' */ if ( *cur == '%' && cur + 20 < limit && @@ -281,7 +281,7 @@ /* look for immediates */ else if ( *cur == '/' && cur + 2 < limit ) { - FT_Int len; + FT_PtrDist len; cur++; @@ -289,11 +289,11 @@ parser->root.cursor = cur; cid_parser_skip_alpha( parser ); - len = (FT_Int)( parser->root.cursor - cur ); + len = parser->root.cursor - cur; if ( len > 0 && len < 22 ) { /* now compare the immediate name to the keyword table */ - T1_Field keyword = (T1_Field) cid_field_records; + T1_Field keyword = (T1_Field)cid_field_records; for (;;) @@ -303,12 +303,15 @@ name = (FT_Byte*)keyword->ident; if ( !name ) - break; - - if ( cur[0] == name[0] && - len == (FT_Int)ft_strlen( (const char*)name ) ) { - FT_Int n; + cid_parser_skip_alpha( parser ); + break; + } + + if ( cur[0] == name[0] && + len == ft_strlen( (const char*)name ) ) + { + FT_PtrDist n; for ( n = 1; n < len; n++ ) diff --git a/src/type1/t1parse.c b/src/type1/t1parse.c index cf12c5ae9..d785aec59 100644 --- a/src/type1/t1parse.c +++ b/src/type1/t1parse.c @@ -65,41 +65,28 @@ /*************************************************************************/ -#define IS_T1_WHITESPACE( c ) ( (c) == ' ' || (c) == '\t' ) -#define IS_T1_LINESPACE( c ) ( (c) == '\r' || (c) == '\n' ) - -#define IS_T1_SPACE( c ) ( IS_T1_WHITESPACE( c ) || IS_T1_LINESPACE( c ) ) - - - typedef struct PFB_Tag_ + static FT_Error + read_pfb_tag( FT_Stream stream, + FT_UShort *atag, + FT_Long *asize ) { + FT_Error error; FT_UShort tag; FT_Long size; - } PFB_Tag; + *atag = 0; + *asize = 0; - static FT_Error - read_pfb_tag( FT_Stream stream, - FT_UShort* tag, - FT_Long* size ) - { - FT_Error error; - PFB_Tag head; - - - *tag = 0; - *size = 0; - - if ( !FT_READ_USHORT( head.tag ) ) + if ( !FT_READ_USHORT( tag ) ) { - if ( head.tag == 0x8001U || head.tag == 0x8002U ) + if ( tag == 0x8001U || tag == 0x8002U ) { - if ( !FT_READ_LONG_LE( head.size ) ) - *size = head.size; + if ( !FT_READ_LONG_LE( size ) ) + *asize = size; } - *tag = head.tag; + *atag = tag; } return error; diff --git a/src/type42/t42parse.c b/src/type42/t42parse.c index ae4b7fcd5..071c6ec1b 100644 --- a/src/type42/t42parse.c +++ b/src/type42/t42parse.c @@ -158,8 +158,8 @@ /* When creating a new Type 42 parser, we try to locate and load */ /* the base dictionary, loading the whole font into memory. */ /* */ - /* When `loading' the base dictionary, we only setup pointers in */ - /* the case of a memory-based stream. Otherwise, we allocate */ + /* When `loading' the base dictionary, we only set up pointers */ + /* in the case of a memory-based stream. Otherwise, we allocate */ /* and load the base dictionary in it. */ /* */ /* parser->in_memory is set if we have a memory stream. */ @@ -245,7 +245,7 @@ static int t42_is_space( FT_Byte c ) { - return ( c == ' ' || c == '\t' || c == '\r' || c == '\n' ); + return ( c == ' ' || c == '\t' || c == '\r' || c == '\n' || c == '\f' ); } @@ -327,6 +327,10 @@ FT_Error error; + if ( encode->char_index ) + /* with synthetic fonts, it's possible we get here twice */ + return; + /* read the number of entries in the encoding, should be 256 */ count = (FT_Int)T1_ToInt( parser ); if ( parser->root.error ) @@ -407,14 +411,14 @@ { /* bingo, we have an immediate name -- it must be a */ /* character name */ - FT_Byte* cur2 = cur + 1; - FT_Int len; + FT_Byte* cur2 = cur + 1; + FT_PtrDist len; while ( cur2 < limit && t42_is_alpha( *cur2 ) ) cur2++; - len = (FT_Int)( cur2 - cur - 1 ); + len = cur2 - cur - 1; parser->root.error = T1_Add_Table( char_table, charcode, cur + 1, len + 1 );