From cdc82b4a8a8c1976aac801da2c33cb7bd9f53ba1 Mon Sep 17 00:00:00 2001 From: David Turner Date: Tue, 24 Sep 2002 23:39:58 +0000 Subject: [PATCH] 2002-09-25 David Turner * src/autohint/ahtypes.h: disabling metrics hinting in the auto-hinter. this produces much better anti-aliased text 2002-09-25 Anthony Fok * src/sfnt/ttcmap0.c: added support for opens___.ttf (it contains a charmap that uses offset=0xFFFFU instead of 0x0000 to indicate a missing glyph) --- ChangeLog | 11 +++++++++++ src/autohint/ahtypes.h | 2 +- src/sfnt/ttcmap0.c | 36 ++++++++++++++++++++++++++++++++---- 3 files changed, 44 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 07c110e9c..fc3228f0c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2002-09-25 David Turner + + * src/autohint/ahtypes.h: disabling metrics hinting in the auto-hinter. + this produces much better anti-aliased text + +2002-09-25 Anthony Fok + + * src/sfnt/ttcmap0.c: added support for opens___.ttf (it contains + a charmap that uses offset=0xFFFFU instead of 0x0000 to indicate a + missing glyph) + 2002-09-21 Wolfgang Domröse * src/truetype/ttdriver.c (Load_Glyph): Fourth parameter must be diff --git a/src/autohint/ahtypes.h b/src/autohint/ahtypes.h index f492d7bb7..50d0f86eb 100644 --- a/src/autohint/ahtypes.h +++ b/src/autohint/ahtypes.h @@ -92,7 +92,7 @@ FT_BEGIN_HEADER /* no reason to do this (at least for non-CJK scripts), except for */ /* experimentation. */ /* */ -#define AH_HINT_METRICS +#undef AH_HINT_METRICS /*************************************************************************/ diff --git a/src/sfnt/ttcmap0.c b/src/sfnt/ttcmap0.c index 3d0f0aae0..30ef8b777 100644 --- a/src/sfnt/ttcmap0.c +++ b/src/sfnt/ttcmap0.c @@ -579,6 +579,12 @@ /* Otherwise, a glyph index is taken from the glyph ids sub-array for */ /* the segment, and the value of `idDelta' is added to it. */ /* */ + /* */ + /* Finally, note that certain fonts contain invalid charmaps that */ + /* contain end=0xFFFF, start=0xFFFF, delta=0x0001, offset=0xFFFF at the */ + /* of their charmaps (e.g. opens___.ttf which comes with OpenOffice.org) */ + /* we need special code to deal with them correctly... */ + /* */ #ifdef TT_CONFIG_CMAP_FORMAT_4 @@ -680,7 +686,7 @@ FT_INVALID_DATA; } - if ( offset ) + if ( offset && offset != 0xFFFFU ) { p += offset; /* start of glyph id array */ @@ -692,10 +698,10 @@ /* check glyph indices within the segment range */ if ( valid->level >= FT_VALIDATE_TIGHT ) { - FT_UInt idx; + FT_UInt i, idx; - for ( ; start < end; ) + for ( i = start; i < end; i++ ) { idx = FT_NEXT_USHORT( p ); if ( idx != 0 ) @@ -708,6 +714,16 @@ } } } + else if ( offset == 0xFFFFU ) + { + /* Some fonts (erroneously?) use a range offset of 0xFFFF */ + /* to mean missing glyph in cmap table */ + /* */ + if ( valid->level >= FT_VALIDATE_PARANOID || + n != num_segs - 1 || + !( start == 0xFFFFU && end == 0xFFFFU && delta == 0x1U ) ) + FT_INVALID_DATA; + } last = end; } @@ -769,6 +785,9 @@ p += num_segs2; offset = TT_PEEK_USHORT( p ); + if ( offset == 0xFFFFU ) + goto Exit; + if ( offset != 0 ) { p += offset + 2 * ( idx - start ); @@ -813,6 +832,9 @@ p += num_segs2; offset = TT_PEEK_USHORT( p ); + if ( offset == 0xFFFFU ) + goto Exit; + if ( offset != 0 ) { p += offset + 2 * ( idx - start ); @@ -879,7 +901,7 @@ p += num_segs2; offset = TT_PEEK_USHORT( p ); - if ( offset != 0 ) + if ( offset != 0 && offset != 0xFFFFU ) { /* parse the glyph ids array for non-0 index */ p += offset + ( code - start ) * 2; @@ -895,6 +917,12 @@ code++; } } + else if ( offset == 0xFFFFU ) + { + /* an offset of 0xFFFF means an empty glyph in certain fonts !! */ + code = end; + break; + } else gindex = (FT_UInt)( code + delta ) & 0xFFFFU;