[Pkg-javascript-commits] [pdf.js] 13/109: Adjust which TrueType (3, 1) glyphs we attempt to skip mapping of (issue 6336)

David Prévot taffit at moszumanska.debian.org
Fri Sep 25 03:04:12 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository pdf.js.

commit 99d29487aba6280ca7be8b4a69863a0160fd42d1
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date:   Sun Aug 9 12:31:05 2015 +0200

    Adjust which TrueType (3, 1) glyphs we attempt to skip mapping of (issue 6336)
    
    Fixes 6336.
---
 src/core/fonts.js       |  10 +++++++---
 test/pdfs/.gitignore    |   1 +
 test/pdfs/issue6336.pdf | Bin 0 -> 10224 bytes
 test/test_manifest.json |   7 +++++++
 4 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/core/fonts.js b/src/core/fonts.js
index 5dfbab3..d9bf1d6 100644
--- a/src/core/fonts.js
+++ b/src/core/fonts.js
@@ -4236,9 +4236,10 @@ var Font = (function FontClosure() {
             if (!glyphName) {
               continue;
             }
-            var unicodeOrCharCode;
+            var unicodeOrCharCode, isUnicode = false;
             if (cmapPlatformId === 3 && cmapEncodingId === 1) {
               unicodeOrCharCode = GlyphsUnicode[glyphName];
+              isUnicode = true;
             } else if (cmapPlatformId === 1 && cmapEncodingId === 0) {
               // TODO: the encoding needs to be updated with mac os table.
               unicodeOrCharCode = Encodings.MacRomanEncoding.indexOf(glyphName);
@@ -4246,8 +4247,11 @@ var Font = (function FontClosure() {
 
             var found = false;
             for (i = 0; i < cmapMappingsLength; ++i) {
-              if (cmapMappings[i].charCode === unicodeOrCharCode &&
-                  hasGlyph(cmapMappings[i].glyphId, unicodeOrCharCode, -1)) {
+              if (cmapMappings[i].charCode !== unicodeOrCharCode) {
+                continue;
+              }
+              var code = isUnicode ? charCode : unicodeOrCharCode;
+              if (hasGlyph(cmapMappings[i].glyphId, code, -1)) {
                 charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
                 found = true;
                 break;
diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore
index 0445acb..9a9a81a 100644
--- a/test/pdfs/.gitignore
+++ b/test/pdfs/.gitignore
@@ -95,6 +95,7 @@
 !issue5599.pdf
 !issue5747.pdf
 !issue6099.pdf
+!issue6336.pdf
 !gradientfill.pdf
 !bug903856.pdf
 !bug850854.pdf
diff --git a/test/pdfs/issue6336.pdf b/test/pdfs/issue6336.pdf
new file mode 100644
index 0000000..5bfa8d1
Binary files /dev/null and b/test/pdfs/issue6336.pdf differ
diff --git a/test/test_manifest.json b/test/test_manifest.json
index 0655467..4fcb797 100644
--- a/test/test_manifest.json
+++ b/test/test_manifest.json
@@ -1182,6 +1182,13 @@
        "link": false,
        "type": "eq"
     },
+    {  "id": "issue6336",
+       "file": "pdfs/issue6336.pdf",
+       "md5": "1c457c12b3606e1de610235d6768bd78",
+       "rounds": 1,
+       "link": false,
+       "type": "eq"
+    },
     {  "id": "issue5801",
        "file": "pdfs/issue5801.pdf",
        "md5": "e9548650ad40e13e00d2a486bbc2bb1b",

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git



More information about the Pkg-javascript-commits mailing list