From 3d3ba0563e4519a0321f12cdfc2220f88bd45295 Mon Sep 17 00:00:00 2001 From: Bram Tassyns Date: Sun, 5 Jul 2009 14:54:59 +0200 Subject: [PATCH] Improve compatibility to Acroread. This fixes Savannah bug #26944. * src/cff/cffload.c (cff_charset_compute_cids): For multiple GID to single CID mappings, make the lowest value win. --- ChangeLog | 8 ++++++++ src/cff/cffload.c | 8 ++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 15921365d..dbd26805d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2009-07-05 Bram Tassyns + + Improve compatibility to Acroread. + This fixes Savannah bug #26944. + + * src/cff/cffload.c (cff_charset_compute_cids): For multiple GID to + single CID mappings, make the lowest value win. + 2009-06-28 suzuki toshiya ftpatent: Fix a bug by wrong usage of service->table_info(). diff --git a/src/cff/cffload.c b/src/cff/cffload.c index 1675ee4e5..14d3db7c7 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -736,6 +736,7 @@ { FT_Error error = FT_Err_Ok; FT_UInt i; + FT_Long j; FT_UShort max_cid = 0; @@ -750,8 +751,11 @@ if ( FT_NEW_ARRAY( charset->cids, max_cid ) ) goto Exit; - for ( i = 0; i < num_glyphs; i++ ) - charset->cids[charset->sids[i]] = (FT_UShort)i; + /* When multiple GIDs map to the same CID, we choose the lowest */ + /* GID. This is not described in any spec, but it matches the */ + /* behaviour of recent Acroread versions. */ + for ( j = num_glyphs - 1; j >= 0 ; j-- ) + charset->cids[charset->sids[j]] = (FT_UShort)j; charset->max_cid = max_cid; charset->num_glyphs = num_glyphs;