Use await
consistently in the PartialEvaluator.translateFont
method
This commit is contained in:
parent
fc62eec901
commit
d1bef8cb86
@ -4169,7 +4169,6 @@ class PartialEvaluator {
|
|||||||
cssFontInfo,
|
cssFontInfo,
|
||||||
}) {
|
}) {
|
||||||
const isType3Font = type === "Type3";
|
const isType3Font = type === "Type3";
|
||||||
let properties;
|
|
||||||
|
|
||||||
if (!descriptor) {
|
if (!descriptor) {
|
||||||
if (isType3Font) {
|
if (isType3Font) {
|
||||||
@ -4200,7 +4199,7 @@ class PartialEvaluator {
|
|||||||
? FontFlags.Symbolic
|
? FontFlags.Symbolic
|
||||||
: FontFlags.Nonsymbolic);
|
: FontFlags.Nonsymbolic);
|
||||||
|
|
||||||
properties = {
|
const properties = {
|
||||||
type,
|
type,
|
||||||
name: baseFontName,
|
name: baseFontName,
|
||||||
loadedName: baseDict.loadedName,
|
loadedName: baseDict.loadedName,
|
||||||
@ -4234,24 +4233,26 @@ class PartialEvaluator {
|
|||||||
standardFontName
|
standardFontName
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return this.extractDataStructures(dict, dict, properties).then(
|
|
||||||
newProperties => {
|
const newProperties = await this.extractDataStructures(
|
||||||
if (widths) {
|
dict,
|
||||||
const glyphWidths = [];
|
dict,
|
||||||
let j = firstChar;
|
properties
|
||||||
for (const width of widths) {
|
|
||||||
glyphWidths[j++] = this.xref.fetchIfRef(width);
|
|
||||||
}
|
|
||||||
newProperties.widths = glyphWidths;
|
|
||||||
} else {
|
|
||||||
newProperties.widths = this.buildCharCodeToWidth(
|
|
||||||
metrics.widths,
|
|
||||||
newProperties
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return new Font(baseFontName, file, newProperties);
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
if (widths) {
|
||||||
|
const glyphWidths = [];
|
||||||
|
let j = firstChar;
|
||||||
|
for (const width of widths) {
|
||||||
|
glyphWidths[j++] = this.xref.fetchIfRef(width);
|
||||||
|
}
|
||||||
|
newProperties.widths = glyphWidths;
|
||||||
|
} else {
|
||||||
|
newProperties.widths = this.buildCharCodeToWidth(
|
||||||
|
metrics.widths,
|
||||||
|
newProperties
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return new Font(baseFontName, file, newProperties);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4355,7 +4356,7 @@ class PartialEvaluator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
properties = {
|
const properties = {
|
||||||
type,
|
type,
|
||||||
name: fontName.name,
|
name: fontName.name,
|
||||||
subtype,
|
subtype,
|
||||||
@ -4398,13 +4399,14 @@ class PartialEvaluator {
|
|||||||
properties.vertical = properties.cMap.vertical;
|
properties.vertical = properties.cMap.vertical;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.extractDataStructures(dict, baseDict, properties).then(
|
const newProperties = await this.extractDataStructures(
|
||||||
newProperties => {
|
dict,
|
||||||
this.extractWidths(dict, descriptor, newProperties);
|
baseDict,
|
||||||
|
properties
|
||||||
return new Font(fontName.name, fontFile, newProperties);
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
this.extractWidths(dict, descriptor, newProperties);
|
||||||
|
|
||||||
|
return new Font(fontName.name, fontFile, newProperties);
|
||||||
}
|
}
|
||||||
|
|
||||||
static buildFontPaths(font, glyphs, handler, evaluatorOptions) {
|
static buildFontPaths(font, glyphs, handler, evaluatorOptions) {
|
||||||
|
Loading…
Reference in New Issue
Block a user