mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Fix loading of PDF files with invalid or missing Type3 characters (issue 5039)
This commit is contained in:
parent
bd1c7be0cb
commit
2485f11829
5 changed files with 24 additions and 8 deletions
|
@ -1760,14 +1760,17 @@ var TranslatedFont = (function TranslatedFontClosure() {
|
|||
var glyphStream = charProcs[key];
|
||||
var operatorList = new OperatorList();
|
||||
return evaluator.getOperatorList(glyphStream, fontResources,
|
||||
operatorList).
|
||||
then(function () {
|
||||
charProcOperatorList[key] = operatorList.getIR();
|
||||
operatorList).then(function () {
|
||||
charProcOperatorList[key] = operatorList.getIR();
|
||||
|
||||
// Add the dependencies to the parent operator list so they are
|
||||
// resolved before sub operator list is executed synchronously.
|
||||
parentOperatorList.addDependencies(operatorList.dependencies);
|
||||
});
|
||||
// Add the dependencies to the parent operator list so they are
|
||||
// resolved before sub operator list is executed synchronously.
|
||||
parentOperatorList.addDependencies(operatorList.dependencies);
|
||||
}, function (reason) {
|
||||
warn('Type3 font resource \"' + key + '\" is not available');
|
||||
var operatorList = new OperatorList();
|
||||
charProcOperatorList[key] = operatorList.getIR();
|
||||
});
|
||||
}.bind(this, charProcKeys[i]));
|
||||
}
|
||||
this.type3Loaded = loadCharProcsPromise.then(function () {
|
||||
|
|
|
@ -1489,11 +1489,16 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
|
|||
continue;
|
||||
}
|
||||
|
||||
var operatorList = font.charProcOperatorList[glyph.operatorListId];
|
||||
if (!operatorList) {
|
||||
warn('Type3 character \"' + glyph.operatorListId +
|
||||
'\" is not available');
|
||||
continue;
|
||||
}
|
||||
this.processingType3 = glyph;
|
||||
this.save();
|
||||
ctx.scale(fontSize, fontSize);
|
||||
ctx.transform.apply(ctx, fontMatrix);
|
||||
var operatorList = font.charProcOperatorList[glyph.operatorListId];
|
||||
this.executeOperatorList(operatorList);
|
||||
this.restore();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue