diff --git a/ChangeLog b/ChangeLog index 29227561e..abcb6d723 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2009-09-01 John Tytgat + + Fix custom cmap for empty Type 1 font (Savannah bug #27294). + + * include/freetype/internal/t1types.h (T1_EncodingRecRec_): Update + comment to reflect revised code_last meaning. + * src/type1/t1load.c (T1_Open_Face), src/type42/t42objs.c + (T42_Open_Face): Assign max_char as highest character code + 1 and + use this for T1_EncodingRecRec_::code_last. + * src/psaux/t1cmap.c (t1_cmap_custom_init): Follow revised + T1_EncodingRecRec_::code_last meaning. + 2009-08-25 Werner Lemberg Fix rendering of horizontally compressed CFFs. diff --git a/include/freetype/internal/t1types.h b/include/freetype/internal/t1types.h index 09cb72138..5f730637b 100644 --- a/include/freetype/internal/t1types.h +++ b/include/freetype/internal/t1types.h @@ -58,7 +58,9 @@ FT_BEGIN_HEADER /* */ /* code_first :: The lowest valid character code in the encoding. */ /* */ - /* code_last :: The highest valid character code in the encoding. */ + /* code_last :: The highest valid character code in the encoding */ + /* + 1. When equal to code_first there are no valid */ + /* character codes. */ /* */ /* char_index :: An array of corresponding glyph indices. */ /* */ diff --git a/src/psaux/t1cmap.c b/src/psaux/t1cmap.c index bbe75cb36..f933e4da8 100644 --- a/src/psaux/t1cmap.c +++ b/src/psaux/t1cmap.c @@ -179,7 +179,7 @@ cmap->first = encoding->code_first; - cmap->count = (FT_UInt)( encoding->code_last - cmap->first + 1 ); + cmap->count = (FT_UInt)( encoding->code_last - cmap->first ); cmap->indices = encoding->char_index; FT_ASSERT( cmap->indices != NULL ); diff --git a/src/type1/t1load.c b/src/type1/t1load.c index 807f95dcc..d867e942c 100644 --- a/src/type1/t1load.c +++ b/src/type1/t1load.c @@ -2182,8 +2182,8 @@ /* the index is then stored in type1.encoding.char_index, and */ /* a the name to 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++ ) @@ -2209,25 +2209,14 @@ { if ( charcode < min_char ) min_char = charcode; - if ( charcode > max_char ) - max_char = charcode; + if ( charcode >= max_char ) + max_char = charcode + 1; } break; } } } - /* - * Yes, this happens: Certain PDF-embedded fonts have only a - * `.notdef' glyph defined! - */ - - if ( min_char > max_char ) - { - min_char = 0; - max_char = loader.encoding_table.max_elems; - } - type1->encoding.code_first = min_char; type1->encoding.code_last = max_char; type1->encoding.num_chars = loader.num_chars; diff --git a/src/type42/t42objs.c b/src/type42/t42objs.c index c0002ae3f..9081ffc6d 100644 --- a/src/type42/t42objs.c +++ b/src/type42/t42objs.c @@ -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;