ref: 3d3ba0563e4519a0321f12cdfc2220f88bd45295
parent: ad289d139f90bd9f439fdcde151127a2912f8834
author: Bram Tassyns <[email protected]>
date: Sun Jul 5 10:54:59 EDT 2009
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.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2009-07-05 Bram Tassyns <[email protected]>
+
+ 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 <[email protected]>
ftpatent: Fix a bug by wrong usage of service->table_info().
--- 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;