Fix type3 font loading regression.
This commit is contained in:
parent
d1cea4a166
commit
c5c2f7a773
@ -520,28 +520,33 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||||||
return promise;
|
return promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
var loadedName = font.loadedName;
|
if (font.loaded) {
|
||||||
if (!loadedName) {
|
promise.resolve({
|
||||||
|
font: font,
|
||||||
|
dependencies: {}
|
||||||
|
});
|
||||||
|
return promise;
|
||||||
|
}
|
||||||
|
|
||||||
// keep track of each font we translated so the caller can
|
// keep track of each font we translated so the caller can
|
||||||
// load them asynchronously before calling display on a page
|
// load them asynchronously before calling display on a page
|
||||||
loadedName = 'g_font_' + this.uniquePrefix + (this.idCounters.font + 1);
|
font.loadedName = 'g_font_' + this.uniquePrefix +
|
||||||
font.loadedName = loadedName;
|
(this.idCounters.font + 1);
|
||||||
|
|
||||||
|
if (!font.translated) {
|
||||||
var translated;
|
var translated;
|
||||||
try {
|
try {
|
||||||
translated = this.translateFont(font, xref);
|
translated = this.translateFont(font, xref);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e instanceof MissingDataException) {
|
if (e instanceof MissingDataException) {
|
||||||
font.loadedName = null;
|
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
translated = new ErrorFont(e instanceof Error ? e.message : e);
|
translated = new ErrorFont(e instanceof Error ? e.message : e);
|
||||||
}
|
}
|
||||||
font.translated = translated;
|
font.translated = translated;
|
||||||
|
}
|
||||||
|
|
||||||
if (translated.loadCharProcs) {
|
if (font.translated.loadCharProcs) {
|
||||||
delete translated.loadCharProcs;
|
|
||||||
|
|
||||||
var charProcs = font.get('CharProcs').getAll();
|
var charProcs = font.get('CharProcs').getAll();
|
||||||
var fontResources = font.get('Resources') || resources;
|
var fontResources = font.get('Resources') || resources;
|
||||||
var opListPromises = [];
|
var opListPromises = [];
|
||||||
@ -561,21 +566,17 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||||||
charProcOperatorList[key] = data.queue;
|
charProcOperatorList[key] = data.queue;
|
||||||
Util.extendObj(dependencies, data.dependencies);
|
Util.extendObj(dependencies, data.dependencies);
|
||||||
}
|
}
|
||||||
translated.charProcOperatorList = charProcOperatorList;
|
font.translated.charProcOperatorList = charProcOperatorList;
|
||||||
|
font.loaded = true;
|
||||||
|
++this.idCounters.font;
|
||||||
promise.resolve({
|
promise.resolve({
|
||||||
font: font,
|
font: font,
|
||||||
dependencies: dependencies
|
dependencies: dependencies
|
||||||
});
|
});
|
||||||
});
|
}.bind(this));
|
||||||
} else {
|
} else {
|
||||||
promise.resolve({
|
|
||||||
font: font,
|
|
||||||
dependencies: {}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
++this.idCounters.font;
|
++this.idCounters.font;
|
||||||
} else {
|
font.loaded = true;
|
||||||
promise.resolve({
|
promise.resolve({
|
||||||
font: font,
|
font: font,
|
||||||
dependencies: {}
|
dependencies: {}
|
||||||
|
BIN
test/pdfs/issue3188.pdf
Normal file
BIN
test/pdfs/issue3188.pdf
Normal file
Binary file not shown.
@ -467,6 +467,13 @@
|
|||||||
"rounds": 1,
|
"rounds": 1,
|
||||||
"type": "eq"
|
"type": "eq"
|
||||||
},
|
},
|
||||||
|
{ "id": "issue3188",
|
||||||
|
"file": "pdfs/issue3188.pdf",
|
||||||
|
"md5": "161b72604d86f40ab2f765ddd3b61227",
|
||||||
|
"rounds": 1,
|
||||||
|
"lastPage": 1,
|
||||||
|
"type": "eq"
|
||||||
|
},
|
||||||
{ "id": "issue1586",
|
{ "id": "issue1586",
|
||||||
"file": "pdfs/pdfjsbad1586.pdf",
|
"file": "pdfs/pdfjsbad1586.pdf",
|
||||||
"md5": "793d0870f0b0c613799b0677d64daca4",
|
"md5": "793d0870f0b0c613799b0677d64daca4",
|
||||||
|
Loading…
Reference in New Issue
Block a user