Change parsingType3Font to a getter (PR 14448 follow-up)
We can easily "compute" `parsingType3Font` from the `type3FontRefs`-value, and thus avoid having to separately track two related properties.
This commit is contained in:
parent
c349ac3a5d
commit
ce52ce063e
@ -224,7 +224,7 @@ class PartialEvaluator {
|
||||
this.globalImageCache = globalImageCache;
|
||||
this.systemFontCache = systemFontCache;
|
||||
this.options = options || DefaultPartialEvaluatorOptions;
|
||||
this.parsingType3Font = false;
|
||||
this.type3FontRefs = null;
|
||||
|
||||
this._regionalImageCache = new RegionalImageCache();
|
||||
this._fetchBuiltInCMapBound = this.fetchBuiltInCMap.bind(this);
|
||||
@ -243,6 +243,10 @@ class PartialEvaluator {
|
||||
return shadow(this, "_pdfFunctionFactory", pdfFunctionFactory);
|
||||
}
|
||||
|
||||
get parsingType3Font() {
|
||||
return !!this.type3FontRefs;
|
||||
}
|
||||
|
||||
clone(newOptions = null) {
|
||||
const newEvaluator = Object.create(this);
|
||||
newEvaluator.options = Object.assign(
|
||||
@ -1253,7 +1257,7 @@ class PartialEvaluator {
|
||||
}
|
||||
}
|
||||
if (fontRef) {
|
||||
if (this.parsingType3Font && this.type3FontRefs.has(fontRef)) {
|
||||
if (this.type3FontRefs?.has(fontRef)) {
|
||||
return errorFont();
|
||||
}
|
||||
|
||||
@ -4633,7 +4637,6 @@ class TranslatedFont {
|
||||
// Compared to the parsing of e.g. an entire page, it doesn't really
|
||||
// make sense to only be able to render a Type3 glyph partially.
|
||||
const type3Evaluator = evaluator.clone({ ignoreErrors: false });
|
||||
type3Evaluator.parsingType3Font = true;
|
||||
// Prevent circular references in Type3 fonts.
|
||||
const type3FontRefs = new RefSet(evaluator.type3FontRefs);
|
||||
if (this.dict.objId && !type3FontRefs.has(this.dict.objId)) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user