2002-09-25 David Turner <david@freetype.org> * src/autohint/ahtypes.h: disabling metrics hinting in the auto-hinter. this produces much better anti-aliased text 2002-09-25 Anthony Fok <anthony@thizlinux.com> * 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)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
diff --git a/ChangeLog b/ChangeLog
index 07c110e..fc3228f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2002-09-25 David Turner <david@freetype.org>
+
+ * src/autohint/ahtypes.h: disabling metrics hinting in the auto-hinter.
+ this produces much better anti-aliased text
+
+2002-09-25 Anthony Fok <anthony@thizlinux.com>
+
+ * 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 <porthos.domroese@harz.de>
* src/truetype/ttdriver.c (Load_Glyph): Fourth parameter must be
diff --git a/src/autohint/ahtypes.h b/src/autohint/ahtypes.h
index f492d7b..50d0f86 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 3d0f0aa..30ef8b7 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;