From 3b6c71ee245660a42b8f99d53ba5a51dc1b84666 Mon Sep 17 00:00:00 2001 From: David Turner Date: Thu, 23 Feb 2006 22:57:31 +0000 Subject: [PATCH] additionnal backwards-compatibility hacks --- src/cache/ftccmap.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/src/cache/ftccmap.c b/src/cache/ftccmap.c index 71944b812..6f1b8eaa3 100644 --- a/src/cache/ftccmap.c +++ b/src/cache/ftccmap.c @@ -316,8 +316,40 @@ query.char_code = (FT_UInt32)cmap_index; break; + case FTC_OLD_CMAP_BY_ENCODING: + case FTC_OLD_CMAP_BY_ID: + { + FT_Face face; + FT_Int nn; + + error = FTC_Manager_LookupFace( cache->manager, desc->face_id, + &face ); + if ( error ) + return error; + + if ( desc->type == FTC_OLD_CMAP_BY_ENCODING ) + { + for ( nn = 0; nn < face->num_charmaps; nn++ ) + if ( face->charmaps[nn]->encoding == desc->u.encoding ) + break; + } + else + { + for ( nn = 0; nn < face->num_charmaps; nn++ ) + if ( face->charmaps[nn]->platform_id == desc->u.id.platform && + face->charmaps[nn]->encoding_id == desc->u.id.encoding ) + break; + } + + if ( nn >= face->num_charmaps ) + return 0; + + query.cmap_index = (FT_UInt)nn; + } + break; + default: - return FT_Err_Unimplemented_Feature; + return 0; } } else