[Pkg-javascript-commits] [pdf.js] 154/210: Fix loading of fonts with empty font files (bug 866395 and issue 3522)
David Prévot
taffit at moszumanska.debian.org
Thu Jun 5 14:21:12 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch upstream
in repository pdf.js.
commit 3e1db41ddd64be44d3e193d92cd3541a96e38a53
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date: Sun May 18 00:57:06 2014 +0200
Fix loading of fonts with empty font files (bug 866395 and issue 3522)
---
src/core/fonts.js | 8 +++++++-
test/pdfs/.gitignore | 1 +
test/pdfs/bug866395.pdf | Bin 0 -> 1879 bytes
test/test_manifest.json | 8 ++++++++
4 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/src/core/fonts.js b/src/core/fonts.js
index 6d01710..5620cbc 100644
--- a/src/core/fonts.js
+++ b/src/core/fonts.js
@@ -2204,7 +2204,13 @@ var Font = (function FontClosure() {
this.defaultVMetrics = properties.defaultVMetrics;
}
- if (!file) {
+ if (!file || file.isEmpty) {
+ if (file) {
+ // Some bad PDF generators will include empty font files,
+ // attempting to recover by assuming that no file exists.
+ warn('Font file is empty in "' + name + '" (' + this.loadedName + ')');
+ }
+
this.missingFile = true;
// The file data is not specified. Trying to fix the font name
// to be used with the canvas.font.
diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore
index efd1825..726a852 100644
--- a/test/pdfs/.gitignore
+++ b/test/pdfs/.gitignore
@@ -55,6 +55,7 @@
!gradientfill.pdf
!bug903856.pdf
!bug850854.pdf
+!bug866395.pdf
!basicapi.pdf
!mixedfonts.pdf
!shading_extend.pdf
diff --git a/test/pdfs/bug866395.pdf b/test/pdfs/bug866395.pdf
new file mode 100644
index 0000000..26af56b
Binary files /dev/null and b/test/pdfs/bug866395.pdf differ
diff --git a/test/test_manifest.json b/test/test_manifest.json
index 0db9c34..d7fd30b 100644
--- a/test/test_manifest.json
+++ b/test/test_manifest.json
@@ -682,6 +682,14 @@
"type": "eq",
"about": "Seac with differences array that messes up mapping."
},
+ { "id": "bug866395",
+ "file": "pdfs/bug866395.pdf",
+ "md5": "f03bc77e84637241980b09a0a220f575",
+ "link": false,
+ "rounds": 1,
+ "type": "eq",
+ "about": "Font with an empty font file."
+ },
{ "id": "ocs",
"file": "pdfs/ocs.pdf",
"md5": "2ade57e954ae7632749cf328daeaa7a8",
--
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