From 835b5ffddd8a5c0cfa7f1fbf7a7a6c15a48bacaa Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Mon, 27 Jul 2020 13:00:24 +0200 Subject: [PATCH] Only check `isType3Font` the first time that `TranslatedFont.loadType3Data` is called If the `TranslatedFont.type3Loaded` property exists, then you already know that the font must be a Type3 one. --- src/core/evaluator.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/core/evaluator.js b/src/core/evaluator.js index cee0da3d7..dd69ef65e 100644 --- a/src/core/evaluator.js +++ b/src/core/evaluator.js @@ -3378,13 +3378,12 @@ class TranslatedFont { } loadType3Data(evaluator, resources, task) { - if (!this.font.isType3Font) { - throw new Error("Must be a Type3 font."); - } - if (this.type3Loaded) { return this.type3Loaded; } + if (!this.font.isType3Font) { + throw new Error("Must be a Type3 font."); + } // 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.