Always export the "raw" /ToUnicode-data from PartialEvaluator.preEvaluateFont
(PR 13354 follow-up)
This, ever so slightly, simplifies the implementation in the `PartialEvaluator.extractDataStructures`-method.
This commit is contained in:
parent
f21a30dfb4
commit
fa583427ef
@ -3428,13 +3428,11 @@ class PartialEvaluator {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async extractDataStructures(dict, baseDict, properties) {
|
async extractDataStructures(dict, properties) {
|
||||||
const xref = this.xref;
|
const xref = this.xref;
|
||||||
let cidToGidBytes;
|
let cidToGidBytes;
|
||||||
// 9.10.2
|
// 9.10.2
|
||||||
const toUnicodePromise = this.readToUnicode(
|
const toUnicodePromise = this.readToUnicode(properties.toUnicode);
|
||||||
properties.toUnicode || dict.get("ToUnicode") || baseDict.get("ToUnicode")
|
|
||||||
);
|
|
||||||
|
|
||||||
if (properties.composite) {
|
if (properties.composite) {
|
||||||
// CIDSystemInfo helps to match CID to glyphs
|
// CIDSystemInfo helps to match CID to glyphs
|
||||||
@ -4017,7 +4015,7 @@ class PartialEvaluator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let composite = false;
|
let composite = false;
|
||||||
let hash, toUnicode;
|
let hash;
|
||||||
if (type.name === "Type0") {
|
if (type.name === "Type0") {
|
||||||
// If font is a composite
|
// If font is a composite
|
||||||
// - get the descendant font
|
// - get the descendant font
|
||||||
@ -4042,6 +4040,8 @@ class PartialEvaluator {
|
|||||||
const firstChar = dict.get("FirstChar") || 0,
|
const firstChar = dict.get("FirstChar") || 0,
|
||||||
lastChar = dict.get("LastChar") || (composite ? 0xffff : 0xff);
|
lastChar = dict.get("LastChar") || (composite ? 0xffff : 0xff);
|
||||||
const descriptor = dict.get("FontDescriptor");
|
const descriptor = dict.get("FontDescriptor");
|
||||||
|
const toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode");
|
||||||
|
|
||||||
if (descriptor) {
|
if (descriptor) {
|
||||||
hash = new MurmurHash3_64();
|
hash = new MurmurHash3_64();
|
||||||
|
|
||||||
@ -4079,7 +4079,6 @@ class PartialEvaluator {
|
|||||||
|
|
||||||
hash.update(`${firstChar}-${lastChar}`); // Fixes issue10665_reduced.pdf
|
hash.update(`${firstChar}-${lastChar}`); // Fixes issue10665_reduced.pdf
|
||||||
|
|
||||||
toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode");
|
|
||||||
if (toUnicode instanceof BaseStream) {
|
if (toUnicode instanceof BaseStream) {
|
||||||
const stream = toUnicode.str || toUnicode;
|
const stream = toUnicode.str || toUnicode;
|
||||||
const uint8array = stream.buffer
|
const uint8array = stream.buffer
|
||||||
@ -4230,7 +4229,6 @@ class PartialEvaluator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const newProperties = await this.extractDataStructures(
|
const newProperties = await this.extractDataStructures(
|
||||||
dict,
|
|
||||||
dict,
|
dict,
|
||||||
properties
|
properties
|
||||||
);
|
);
|
||||||
@ -4394,11 +4392,7 @@ class PartialEvaluator {
|
|||||||
properties.vertical = properties.cMap.vertical;
|
properties.vertical = properties.cMap.vertical;
|
||||||
}
|
}
|
||||||
|
|
||||||
const newProperties = await this.extractDataStructures(
|
const newProperties = await this.extractDataStructures(dict, properties);
|
||||||
dict,
|
|
||||||
baseDict,
|
|
||||||
properties
|
|
||||||
);
|
|
||||||
this.extractWidths(dict, descriptor, newProperties);
|
this.extractWidths(dict, descriptor, newProperties);
|
||||||
|
|
||||||
return new Font(fontName.name, fontFile, newProperties);
|
return new Font(fontName.name, fontFile, newProperties);
|
||||||
|
Loading…
Reference in New Issue
Block a user