mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Merge pull request #12824 from Snuffleupagus/preEvaluateFont-errors
Improve the handling of errors, in `PartialEvaluator.loadFont`, occuring in `PartialEvaluator.preEvaluateFont` (issue 12823)
This commit is contained in:
commit
048081fb69
4 changed files with 17 additions and 1 deletions
|
@ -1062,7 +1062,13 @@ class PartialEvaluator {
|
|||
|
||||
var fontCapability = createPromiseCapability();
|
||||
|
||||
var preEvaluatedFont = this.preEvaluateFont(font);
|
||||
let preEvaluatedFont;
|
||||
try {
|
||||
preEvaluatedFont = this.preEvaluateFont(font);
|
||||
} catch (reason) {
|
||||
warn(`loadFont - ignoring preEvaluateFont errors: "${reason}".`);
|
||||
return errorFont();
|
||||
}
|
||||
const { descriptor, hash } = preEvaluatedFont;
|
||||
|
||||
var fontRefIsRef = isRef(fontRef),
|
||||
|
@ -3258,6 +3264,9 @@ class PartialEvaluator {
|
|||
}
|
||||
dict = Array.isArray(df) ? this.xref.fetchIfRef(df[0]) : df;
|
||||
|
||||
if (!(dict instanceof Dict)) {
|
||||
throw new FormatError("Descendant font is not a dictionary.");
|
||||
}
|
||||
type = dict.get("Subtype");
|
||||
if (!isName(type)) {
|
||||
throw new FormatError("invalid font Subtype");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue