Use await consistently in the PartialEvaluator.translateFont method

This commit is contained in:
Jonas Jenwald 2024-01-21 17:36:50 +01:00
parent fc62eec901
commit d1bef8cb86

View File

@ -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,8 +4233,12 @@ class PartialEvaluator {
standardFontName standardFontName
); );
} }
return this.extractDataStructures(dict, dict, properties).then(
newProperties => { const newProperties = await this.extractDataStructures(
dict,
dict,
properties
);
if (widths) { if (widths) {
const glyphWidths = []; const glyphWidths = [];
let j = firstChar; let j = firstChar;
@ -4251,8 +4254,6 @@ class PartialEvaluator {
} }
return new Font(baseFontName, file, newProperties); return new Font(baseFontName, file, newProperties);
} }
);
}
} }
// According to the spec if 'FontDescriptor' is declared, 'FirstChar', // According to the spec if 'FontDescriptor' is declared, 'FirstChar',
@ -4355,7 +4356,7 @@ class PartialEvaluator {
} }
} }
properties = { const properties = {
type, type,
name: fontName.name, name: fontName.name,
subtype, subtype,
@ -4398,14 +4399,15 @@ 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,
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);
} }
);
}
static buildFontPaths(font, glyphs, handler, evaluatorOptions) { static buildFontPaths(font, glyphs, handler, evaluatorOptions) {
function buildPath(fontChar) { function buildPath(fontChar) {