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
@ -1062,7 +1062,13 @@ class PartialEvaluator {
|
|||||||
|
|
||||||
var fontCapability = createPromiseCapability();
|
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;
|
const { descriptor, hash } = preEvaluatedFont;
|
||||||
|
|
||||||
var fontRefIsRef = isRef(fontRef),
|
var fontRefIsRef = isRef(fontRef),
|
||||||
@ -3258,6 +3264,9 @@ class PartialEvaluator {
|
|||||||
}
|
}
|
||||||
dict = Array.isArray(df) ? this.xref.fetchIfRef(df[0]) : df;
|
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");
|
type = dict.get("Subtype");
|
||||||
if (!isName(type)) {
|
if (!isName(type)) {
|
||||||
throw new FormatError("invalid font Subtype");
|
throw new FormatError("invalid font Subtype");
|
||||||
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -70,6 +70,7 @@
|
|||||||
!issue8570.pdf
|
!issue8570.pdf
|
||||||
!issue8697.pdf
|
!issue8697.pdf
|
||||||
!issue8702.pdf
|
!issue8702.pdf
|
||||||
|
!issue12823.pdf
|
||||||
!issue8707.pdf
|
!issue8707.pdf
|
||||||
!issue8798r.pdf
|
!issue8798r.pdf
|
||||||
!issue8823.pdf
|
!issue8823.pdf
|
||||||
|
BIN
test/pdfs/issue12823.pdf
Normal file
BIN
test/pdfs/issue12823.pdf
Normal file
Binary file not shown.
@ -1163,6 +1163,12 @@
|
|||||||
"link": false,
|
"link": false,
|
||||||
"type": "eq"
|
"type": "eq"
|
||||||
},
|
},
|
||||||
|
{ "id": "issue12823",
|
||||||
|
"file": "pdfs/issue12823.pdf",
|
||||||
|
"md5": "8391c63006ccc4b41c95de5e8c38deeb",
|
||||||
|
"rounds": 1,
|
||||||
|
"type": "eq"
|
||||||
|
},
|
||||||
{ "id": "bug1050040",
|
{ "id": "bug1050040",
|
||||||
"file": "pdfs/bug1050040.pdf",
|
"file": "pdfs/bug1050040.pdf",
|
||||||
"md5": "9076b29bd157e2646b457f29a4472a07",
|
"md5": "9076b29bd157e2646b457f29a4472a07",
|
||||||
|
Loading…
Reference in New Issue
Block a user