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.
This commit is contained in:
John Tytgat 2009-09-01 08:10:24 +02:00 committed by Werner Lemberg
parent 17904a107a
commit 03e8b2f763
5 changed files with 25 additions and 21 deletions

View File

@ -1,3 +1,15 @@
2009-09-01 John Tytgat <John.Tytgat@esko.com>
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 <wl@gnu.org>
Fix rendering of horizontally compressed CFFs.

View File

@ -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. */
/* */

View File

@ -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 );

View File

@ -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;

View File

@ -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;