[Pkg-javascript-commits] [pdf.js] 37/116: Add support for TrueType (0, 0) cmap tables (issue 5501 and 5574)

David Prévot taffit at moszumanska.debian.org
Fri Mar 6 16:19:59 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 ad41a2d57459f53fbf7010c057d540acaf068577
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date:   Sun Jan 11 14:54:12 2015 +0100

    Add support for TrueType (0, 0) cmap tables (issue 5501 and 5574)
---
 src/core/fonts.js       |  12 +++++++++++-
 test/pdfs/.gitignore    |   1 +
 test/pdfs/issue5501.pdf | Bin 0 -> 15180 bytes
 test/test_manifest.json |   7 +++++++
 4 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/src/core/fonts.js b/src/core/fonts.js
index bd2850f..95d30dc 100644
--- a/src/core/fonts.js
+++ b/src/core/fonts.js
@@ -3175,7 +3175,11 @@ var Font = (function FontClosure() {
           var offset = font.getInt32() >>> 0;
           var useTable = false;
 
-          if (platformId === 1 && encodingId === 0) {
+          if (platformId === 0 && encodingId === 0) {
+            useTable = true;
+            // Continue the loop since there still may be a higher priority
+            // table.
+          } else if (platformId === 1 && encodingId === 0) {
             useTable = true;
             // Continue the loop since there still may be a higher priority
             // table.
@@ -4148,6 +4152,12 @@ var Font = (function FontClosure() {
               }
             }
           }
+        } else if (cmapPlatformId === 0 && cmapEncodingId === 0) {
+          // Default Unicode semantics, use the charcodes as is.
+          for (i = 0; i < cmapMappingsLength; ++i) {
+            charCodeToGlyphId[cmapMappings[i].charCode] =
+              cmapMappings[i].glyphId;
+          }
         } else {
           // For (3, 0) cmap tables:
           // The charcode key being stored in charCodeToGlyphId is the lower
diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore
index e612c39..d1d03af 100644
--- a/test/pdfs/.gitignore
+++ b/test/pdfs/.gitignore
@@ -70,6 +70,7 @@
 !issue5291.pdf
 !issue5421.pdf
 !issue5470.pdf
+!issue5501.pdf
 !issue5599.pdf
 !gradientfill.pdf
 !bug903856.pdf
diff --git a/test/pdfs/issue5501.pdf b/test/pdfs/issue5501.pdf
new file mode 100644
index 0000000..2441554
Binary files /dev/null and b/test/pdfs/issue5501.pdf differ
diff --git a/test/test_manifest.json b/test/test_manifest.json
index 1e05ff5..b92a41c 100644
--- a/test/test_manifest.json
+++ b/test/test_manifest.json
@@ -499,6 +499,13 @@
        "link": false,
        "type": "eq"
     },
+    {  "id": "issue5501",
+       "file": "pdfs/issue5501.pdf",
+       "md5": "55a60699728fc92f491a2d7d490474e4",
+       "rounds": 1,
+       "link": false,
+       "type": "eq"
+    },
     {  "id": "issue5509",
        "file": "pdfs/issue5509.pdf",
        "md5": "1975ef8db7355b1d691bc79d0749574b",

-- 
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