Fix type3 font loading regression.
This commit is contained in:
parent
d1cea4a166
commit
c5c2f7a773
@ -520,62 +520,63 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||||||
return promise;
|
return promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
var loadedName = font.loadedName;
|
if (font.loaded) {
|
||||||
if (!loadedName) {
|
promise.resolve({
|
||||||
// keep track of each font we translated so the caller can
|
font: font,
|
||||||
// load them asynchronously before calling display on a page
|
dependencies: {}
|
||||||
loadedName = 'g_font_' + this.uniquePrefix + (this.idCounters.font + 1);
|
});
|
||||||
font.loadedName = loadedName;
|
return promise;
|
||||||
|
}
|
||||||
|
|
||||||
|
// keep track of each font we translated so the caller can
|
||||||
|
// load them asynchronously before calling display on a page
|
||||||
|
font.loadedName = 'g_font_' + this.uniquePrefix +
|
||||||
|
(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 fontResources = font.get('Resources') || resources;
|
||||||
var charProcs = font.get('CharProcs').getAll();
|
var opListPromises = [];
|
||||||
var fontResources = font.get('Resources') || resources;
|
var charProcKeys = Object.keys(charProcs);
|
||||||
var opListPromises = [];
|
for (var i = 0, n = charProcKeys.length; i < n; ++i) {
|
||||||
var charProcKeys = Object.keys(charProcs);
|
var key = charProcKeys[i];
|
||||||
|
var glyphStream = charProcs[key];
|
||||||
|
opListPromises.push(
|
||||||
|
this.getOperatorList(glyphStream, fontResources));
|
||||||
|
}
|
||||||
|
Promise.all(opListPromises).then(function(datas) {
|
||||||
|
var charProcOperatorList = {};
|
||||||
|
var dependencies = {};
|
||||||
for (var i = 0, n = charProcKeys.length; i < n; ++i) {
|
for (var i = 0, n = charProcKeys.length; i < n; ++i) {
|
||||||
var key = charProcKeys[i];
|
var key = charProcKeys[i];
|
||||||
var glyphStream = charProcs[key];
|
var data = datas[i];
|
||||||
opListPromises.push(
|
charProcOperatorList[key] = data.queue;
|
||||||
this.getOperatorList(glyphStream, fontResources));
|
Util.extendObj(dependencies, data.dependencies);
|
||||||
}
|
}
|
||||||
Promise.all(opListPromises).then(function(datas) {
|
font.translated.charProcOperatorList = charProcOperatorList;
|
||||||
var charProcOperatorList = {};
|
font.loaded = true;
|
||||||
var dependencies = {};
|
++this.idCounters.font;
|
||||||
for (var i = 0, n = charProcKeys.length; i < n; ++i) {
|
|
||||||
var key = charProcKeys[i];
|
|
||||||
var data = datas[i];
|
|
||||||
charProcOperatorList[key] = data.queue;
|
|
||||||
Util.extendObj(dependencies, data.dependencies);
|
|
||||||
}
|
|
||||||
translated.charProcOperatorList = charProcOperatorList;
|
|
||||||
promise.resolve({
|
|
||||||
font: font,
|
|
||||||
dependencies: dependencies
|
|
||||||
});
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
promise.resolve({
|
promise.resolve({
|
||||||
font: font,
|
font: font,
|
||||||
dependencies: {}
|
dependencies: dependencies
|
||||||
});
|
});
|
||||||
}
|
}.bind(this));
|
||||||
|
|
||||||
++this.idCounters.font;
|
|
||||||
} else {
|
} else {
|
||||||
|
++this.idCounters.font;
|
||||||
|
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