ref: 2ded2c1d30f8294b1b8215013fee4112d182ebf3
parent: ed54f28e4ac2ff2ed0016fe8b2d0f5d7b4689ef3
author: David Turner <[email protected]>
date: Fri Mar 22 17:37:40 EST 2002
* 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)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2002-03-22 David Turner <[email protected]>
+ * 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,
--- 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 );
--- 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,7 +713,7 @@
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);
@@ -720,7 +720,7 @@
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 )
--- 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;