1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Fix loading of fonts with empty font files (bug 866395 and issue 3522)

This commit is contained in:
Jonas Jenwald 2014-05-18 00:57:06 +02:00
parent ea0453f106
commit 3e1db41ddd
4 changed files with 16 additions and 1 deletions

View file

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