diff --git a/src/core/evaluator.js b/src/core/evaluator.js index 68ab49bb0..4ccb5e0b7 100644 --- a/src/core/evaluator.js +++ b/src/core/evaluator.js @@ -3428,13 +3428,11 @@ class PartialEvaluator { }); } - async extractDataStructures(dict, baseDict, properties) { + async extractDataStructures(dict, properties) { const xref = this.xref; let cidToGidBytes; // 9.10.2 - const toUnicodePromise = this.readToUnicode( - properties.toUnicode || dict.get("ToUnicode") || baseDict.get("ToUnicode") - ); + const toUnicodePromise = this.readToUnicode(properties.toUnicode); if (properties.composite) { // CIDSystemInfo helps to match CID to glyphs @@ -4017,7 +4015,7 @@ class PartialEvaluator { } let composite = false; - let hash, toUnicode; + let hash; if (type.name === "Type0") { // If font is a composite // - get the descendant font @@ -4042,6 +4040,8 @@ class PartialEvaluator { const firstChar = dict.get("FirstChar") || 0, lastChar = dict.get("LastChar") || (composite ? 0xffff : 0xff); const descriptor = dict.get("FontDescriptor"); + const toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode"); + if (descriptor) { hash = new MurmurHash3_64(); @@ -4079,7 +4079,6 @@ class PartialEvaluator { hash.update(`${firstChar}-${lastChar}`); // Fixes issue10665_reduced.pdf - toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode"); if (toUnicode instanceof BaseStream) { const stream = toUnicode.str || toUnicode; const uint8array = stream.buffer @@ -4230,7 +4229,6 @@ class PartialEvaluator { } const newProperties = await this.extractDataStructures( - dict, dict, properties ); @@ -4394,11 +4392,7 @@ class PartialEvaluator { properties.vertical = properties.cMap.vertical; } - const newProperties = await this.extractDataStructures( - dict, - baseDict, - properties - ); + const newProperties = await this.extractDataStructures(dict, properties); this.extractWidths(dict, descriptor, newProperties); return new Font(fontName.name, fontFile, newProperties);