From 2ded2c1d30f8294b1b8215013fee4112d182ebf3 Mon Sep 17 00:00:00 2001 From: David Turner Date: Fri, 22 Mar 2002 22:37:40 +0000 Subject: [PATCH] * 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) --- ChangeLog | 5 +++++ src/base/ftobjs.c | 22 ++++++++++++++++++++++ src/sfnt/ttcmap0.c | 8 +++++--- src/type1/t1objs.c | 4 +--- 4 files changed, 33 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5433ef3b1..cd1816e28 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2002-03-22 David Turner + * 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 780b9be3e..2b341b07c 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 f0aa9655d..7932db204 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 68087f5db..32346afa0 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;