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.
This commit is contained in:
Jonas Jenwald 2020-07-27 13:00:24 +02:00
parent f3ff526019
commit 835b5ffddd

View File

@ -3378,13 +3378,12 @@ class TranslatedFont {
} }
loadType3Data(evaluator, resources, task) { loadType3Data(evaluator, resources, task) {
if (!this.font.isType3Font) {
throw new Error("Must be a Type3 font.");
}
if (this.type3Loaded) { if (this.type3Loaded) {
return 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. // 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 // 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. // make sense to only be able to render a Type3 glyph partially.