[Pkg-javascript-commits] [pdf.js] 68/109: Fallback in `readCmapTable`, instead of using `error`, for TrueType fonts with unsupported cmap formats (bug 1200096)
David Prévot
taffit at moszumanska.debian.org
Fri Sep 25 03:04:19 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 0fb31a4a9e44add7dcbf375daa4e667126d44aa2
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date: Tue Sep 1 13:31:02 2015 +0200
Fallback in `readCmapTable`, instead of using `error`, for TrueType fonts with unsupported cmap formats (bug 1200096)
Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1200096.
The problematic font has a `format 2` cmap, which we've never supported properly. Prior to PR 2606, we were able to fallback to a working state, despite not having proper support for that cmap format.
Obviously the best/correct solution would be to implement actual support for more cmap formats[1]. However, I'm hoping that a simple patch will be OK for now, given that:
- `format 2` cmaps seem to be quite rare in practice, since this has been broken for 2.5 years before anyone noticed.
- Having a simple patch will make potential uplifts a lot easier.
[1] See the specification at https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6cmap.html
---
src/core/fonts.js | 8 +++++++-
test/pdfs/.gitignore | 1 +
test/pdfs/bug1200096.pdf | Bin 0 -> 117519 bytes
test/test_manifest.json | 7 +++++++
4 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/core/fonts.js b/src/core/fonts.js
index d9bf1d6..0f457bc 100644
--- a/src/core/fonts.js
+++ b/src/core/fonts.js
@@ -3390,7 +3390,13 @@ var Font = (function FontClosure() {
});
}
} else {
- error('cmap table has unsupported format: ' + format);
+ warn('cmap table has unsupported format: ' + format);
+ return {
+ platformId: -1,
+ encodingId: -1,
+ mappings: [],
+ hasShortCmap: false
+ };
}
// removing duplicate entries
diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore
index b190519..fba469f 100644
--- a/test/pdfs/.gitignore
+++ b/test/pdfs/.gitignore
@@ -15,6 +15,7 @@
!arial_unicode_en_cidfont.pdf
!asciihexdecode.pdf
!bug1050040.pdf
+!bug1200096.pdf
!canvas.pdf
!complex_ttf_font.pdf
!extgstate.pdf
diff --git a/test/pdfs/bug1200096.pdf b/test/pdfs/bug1200096.pdf
new file mode 100644
index 0000000..140024b
Binary files /dev/null and b/test/pdfs/bug1200096.pdf differ
diff --git a/test/test_manifest.json b/test/test_manifest.json
index f7c857b..a383cfd 100644
--- a/test/test_manifest.json
+++ b/test/test_manifest.json
@@ -629,6 +629,13 @@
"link": false,
"type": "eq"
},
+ { "id": "bug1200096",
+ "file": "pdfs/bug1200096.pdf",
+ "md5": "b6bd8df094b5d511c13ed095d2a07515",
+ "rounds": 1,
+ "link": false,
+ "type": "eq"
+ },
{ "id": "hudsonsurvey",
"file": "pdfs/hudsonsurvey.pdf",
"md5": "bf0e6576a7b6c2fe7485bce1b78e006f",
--
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