From 315b089b28fcf8e0f7ff04b6c2596c0553b98405 Mon Sep 17 00:00:00 2001 From: notmasteryet Date: Fri, 9 Dec 2011 21:21:58 -0600 Subject: [PATCH] (#919) Fixing toUnicode mapping for TrueType fonts with identity mapping --- src/fonts.js | 4 ++++ test/pdfs/issue919.pdf.link | 1 + test/test_manifest.json | 8 ++++++++ 3 files changed, 13 insertions(+) create mode 100644 test/pdfs/issue919.pdf.link diff --git a/src/fonts.js b/src/fonts.js index 8609ae608..de8a76dcd 100644 --- a/src/fonts.js +++ b/src/fonts.js @@ -1791,6 +1791,10 @@ var Font = (function FontClosure() { var i = unassignedUnicodeItems[j]; while (unusedUnicode in usedUnicodes) unusedUnicode++; + var cid = i + 1; + // override only if unicode mapping is not specified + if (!(cid in toUnicode)) + toUnicode[cid] = unusedUnicode; glyphs[i].unicode = unusedUnicode++; } this.useToUnicode = true; diff --git a/test/pdfs/issue919.pdf.link b/test/pdfs/issue919.pdf.link new file mode 100644 index 000000000..683001139 --- /dev/null +++ b/test/pdfs/issue919.pdf.link @@ -0,0 +1 @@ +http://agb.traviangames.com/Travian_AR_Terms.pdf diff --git a/test/test_manifest.json b/test/test_manifest.json index 4d55ac0f7..8e8098317 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -340,5 +340,13 @@ "link": true, "pageLimit": 3, "type": "eq" + }, + { "id": "issue919", + "file": "pdfs/issue919.pdf", + "md5": "3a1716a512aca4d7a8d6106bd4885d14", + "rounds": 1, + "link": true, + "pageLimit": 3, + "type": "eq" } ]