Ensure that the old/new options are correctly combined in PartialEvaluator.clone

This commit is contained in:
Jonas Jenwald 2021-05-31 12:13:20 +02:00
parent 8c53bf8647
commit e3bde56311

View File

@ -229,9 +229,13 @@ class PartialEvaluator {
return shadow(this, "_pdfFunctionFactory", pdfFunctionFactory);
}
clone(newOptions = DefaultPartialEvaluatorOptions) {
clone(newOptions = null) {
const newEvaluator = Object.create(this);
newEvaluator.options = newOptions;
newEvaluator.options = Object.assign(
Object.create(null),
this.options,
newOptions
);
return newEvaluator;
}
@ -3948,9 +3952,7 @@ class TranslatedFont {
// When parsing Type3 glyphs, always ignore them if there are errors.
// 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 type3Options = Object.create(evaluator.options);
type3Options.ignoreErrors = false;
const type3Evaluator = evaluator.clone(type3Options);
const type3Evaluator = evaluator.clone({ ignoreErrors: false });
type3Evaluator.parsingType3Font = true;
const translatedFont = this.font,