[Pkg-javascript-commits] [pdf.js] 90/115: Use `adjustWidths` for TrueType fonts if we handle them as OpenType (issue 5027, issue 5084, issue 6556, bug 1204903)

David Prévot taffit at moszumanska.debian.org
Wed Dec 16 20:03:20 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 ee0d522187999eb4ce89cd113c982a30172295bf
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date:   Mon Dec 7 22:30:09 2015 +0100

    Use `adjustWidths` for TrueType fonts if we handle them as OpenType (issue 5027, issue 5084, issue 6556, bug 1204903)
    
    In `Font_checkAndRepair` we can decide that a font isn't TrueType, and instead parse it as CFF. In that case it's quite possible that the `fontMatrix` will be changed, and without calling `adjustWidths` we're failing to update the glyph widths correctly.
    
    Fixes 5027.
    Fixes 5084.
    Fixes 6556.
    Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1204903.
---
 src/core/fonts.js       |   7 +++++++
 test/pdfs/.gitignore    |   1 +
 test/pdfs/issue5084.pdf | Bin 0 -> 15526 bytes
 test/test_manifest.json |   7 +++++++
 4 files changed, 15 insertions(+)

diff --git a/src/core/fonts.js b/src/core/fonts.js
index 45a984e..cfb1f1c 100644
--- a/src/core/fonts.js
+++ b/src/core/fonts.js
@@ -2133,6 +2133,9 @@ function reverseIfRtl(chars) {
 }
 
 function adjustWidths(properties) {
+  if (!properties.fontMatrix) {
+    return;
+  }
   if (properties.fontMatrix[0] === FONT_IDENTITY_MATRIX[0]) {
     return;
   }
@@ -2647,6 +2650,8 @@ var Font = (function FontClosure() {
         // view of the sanitizer
         data = this.checkAndRepair(name, file, properties);
         if (this.isOpenType) {
+          adjustWidths(properties);
+
           type = 'OpenType';
         }
         break;
@@ -4079,6 +4084,8 @@ var Font = (function FontClosure() {
           cffFile = new Stream(tables['CFF '].data);
           cff = new CFFFont(cffFile, properties);
 
+          adjustWidths(properties);
+
           return this.convert(name, cff, properties);
         }
 
diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore
index 290cea9..00fa955 100644
--- a/test/pdfs/.gitignore
+++ b/test/pdfs/.gitignore
@@ -46,6 +46,7 @@
 !issue6413.pdf
 !issue4630.pdf
 !issue4909.pdf
+!issue5084.pdf
 !issue5202.pdf
 !issue5280.pdf
 !issue5677.pdf
diff --git a/test/pdfs/issue5084.pdf b/test/pdfs/issue5084.pdf
new file mode 100644
index 0000000..d35ee16
Binary files /dev/null and b/test/pdfs/issue5084.pdf differ
diff --git a/test/test_manifest.json b/test/test_manifest.json
index 986524a..88eda0a 100644
--- a/test/test_manifest.json
+++ b/test/test_manifest.json
@@ -748,6 +748,13 @@
        "rounds": 1,
        "type": "eq"
     },
+    {  "id": "issue5084",
+       "file": "pdfs/issue5084.pdf",
+       "md5": "a42a076ba90e20e3aae9af869eb4de45",
+       "link": false,
+       "rounds": 1,
+       "type": "eq"
+    },
     {  "id": "scan-bad",
        "file": "pdfs/scan-bad.pdf",
        "md5": "4cf988f01ab83f61aca57f406dfd6584",

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