[Pkg-javascript-commits] [pdf.js] 25/72: Correctly detect OpenType font files with CFF data

David Prévot taffit at moszumanska.debian.org
Wed Mar 18 20:15:56 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 f81fc9091aa853f8bd8f9ce06ef91fab2016a14b
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date:   Sat Feb 28 12:58:53 2015 +0100

    Correctly detect OpenType font files with CFF data
    
    Fixes 5334.
    Fixes 215.
    Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1125614.
    
    According to the specification, http://www.microsoft.com/typography/otspec/otff.htm, OpenType font files with CFF data should have `OTTO` in the header.
---
 src/core/fonts.js       |   5 ++---
 test/pdfs/.gitignore    |   1 +
 test/pdfs/issue5334.pdf | Bin 0 -> 65778 bytes
 test/test_manifest.json |   7 +++++++
 4 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/core/fonts.js b/src/core/fonts.js
index 1f904cd..0541292 100644
--- a/src/core/fonts.js
+++ b/src/core/fonts.js
@@ -2572,8 +2572,6 @@ var Font = (function FontClosure() {
     if (subtype === 'CIDFontType0C' && type !== 'CIDFontType0') {
       type = 'CIDFontType0';
     }
-    // XXX: Temporarily change the type for open type so we trigger a warning.
-    // This should be removed when we add support for open type.
     if (subtype === 'OpenType') {
       type = 'OpenType';
     }
@@ -3980,7 +3978,8 @@ var Font = (function FontClosure() {
       var isTrueType = !tables['CFF '];
       if (!isTrueType) {
         // OpenType font
-        if (!tables.head || !tables.hhea || !tables.maxp || !tables.post) {
+        if (header.version === 'OTTO' ||
+            !tables.head || !tables.hhea || !tables.maxp || !tables.post) {
           // no major tables: throwing everything at CFFFont
           cffFile = new Stream(tables['CFF '].data);
           cff = new CFFFont(cffFile, properties);
diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore
index 344cb39..daf18d1 100644
--- a/test/pdfs/.gitignore
+++ b/test/pdfs/.gitignore
@@ -113,6 +113,7 @@
 !issue4722.pdf
 !issue4800.pdf
 !issue4801.pdf
+!issue5334.pdf
 !issue5549.pdf
 !issue5475.pdf
 !issue5481.pdf
diff --git a/test/pdfs/issue5334.pdf b/test/pdfs/issue5334.pdf
new file mode 100644
index 0000000..8dbe7b9
Binary files /dev/null and b/test/pdfs/issue5334.pdf differ
diff --git a/test/test_manifest.json b/test/test_manifest.json
index ed698c2..adee57b 100644
--- a/test/test_manifest.json
+++ b/test/test_manifest.json
@@ -421,6 +421,13 @@
        "rounds": 1,
        "type": "load"
     },
+    {  "id": "issue5334",
+       "file": "pdfs/issue5334.pdf",
+       "md5": "5575020f37f6e5b3c43b8183bf7f96ae",
+       "rounds": 1,
+       "link": false,
+       "type": "eq"
+    },
     {  "id": "bug850854",
        "file": "pdfs/bug850854.pdf",
        "md5": "346a034a80120d123b9fefc42bcb11da",

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