diff --git a/src/core/evaluator.js b/src/core/evaluator.js index 1ed1c3749..5e31d0d92 100644 --- a/src/core/evaluator.js +++ b/src/core/evaluator.js @@ -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)) {