* src/base/ftobjs.c, src/sfnt/ttcmap0.c, src/type1/t1objs.c: various fixes to make the FT_CMaps support work correctly (more tests are still needed)
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
diff --git a/ChangeLog b/ChangeLog
index 5433ef3..cd1816e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2002-03-22 David Turner <david@freetype.org>
+ * src/base/ftobjs.c, src/sfnt/ttcmap0.c, src/type1/t1objs.c:
+
+ various fixes to make the FT_CMaps support work correctly
+ (more tests are still needed)
+
* include/freetype/internal/ftobjs.h,
src/sfnt/Jamfile, src/sfnt/rules.mk,
src/sfnt/sfnt.c, src/sfnt/sfobjs.c,
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 780b9be..2b341b0 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -612,6 +612,28 @@
if ( face->generic.finalizer )
face->generic.finalizer( face );
+#ifdef FT_CONFIG_OPTION_USE_CMAPS
+
+ /* discard charmaps */
+ {
+ FT_Int n;
+
+ for ( n = 0; n < face->num_charmaps; n++ )
+ {
+ FT_CMap cmap = FT_CMAP( face->charmaps[n] );
+
+ FT_CMap_Done( cmap );
+
+ face->charmaps[n] = NULL;
+ }
+
+ FT_FREE( face->charmaps );
+ face->num_charmaps = 0;
+ }
+
+#endif /* FT_CONFIG_OPTION_USE_CMAPS */
+
+
/* finalize format-specific stuff */
if ( clazz->done_face )
clazz->done_face( face );
diff --git a/src/sfnt/ttcmap0.c b/src/sfnt/ttcmap0.c
index f0aa965..7932db2 100644
--- a/src/sfnt/ttcmap0.c
+++ b/src/sfnt/ttcmap0.c
@@ -642,7 +642,7 @@
p = deltas + n*2; delta = TT_PEEK_SHORT(p);
p = offsets + n*2; offset = TT_PEEK_USHORT(p);
- if ( end > start )
+ if ( start > end )
FT_INVALID_DATA;
if ( n > 0 && start <= last )
@@ -713,14 +713,14 @@
if ( code <= end )
{
- index = (FT_UInt)( char_code - start );
+ index = code;
p = q + num_segs2 - 2; delta = TT_PEEK_SHORT(p);
p += num_segs2; offset = TT_PEEK_USHORT(p);
if ( offset != 0 )
{
- p += offset + 2*index;
+ p += offset + 2*(index - start);
index = TT_PEEK_USHORT(p);
}
@@ -1575,6 +1575,8 @@
charmap.platform_id = TT_NEXT_USHORT(p);
charmap.encoding_id = TT_NEXT_USHORT(p);
+ charmap.face = FT_FACE(face);
+ charmap.encoding = 0; /* will be filled later */
offset = TT_NEXT_ULONG(p);
if ( offset && table + offset + 2 < limit )
diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c
index 68087f5..32346af 100644
--- a/src/type1/t1objs.c
+++ b/src/type1/t1objs.c
@@ -324,9 +324,7 @@
FT_Face root = (FT_Face)&face->root;
- root->num_glyphs = face->type1.num_glyphs;
- root->num_charmaps = 1;
-
+ root->num_glyphs = face->type1.num_glyphs;
root->face_index = face_index;
root->face_flags = FT_FACE_FLAG_SCALABLE;