Convert the PartialEvaluator.readToUnicode
method to be async
This commit is contained in:
parent
f5c01188dc
commit
f21a30dfb4
@ -3765,28 +3765,30 @@ class PartialEvaluator {
|
||||
return new IdentityToUnicodeMap(properties.firstChar, properties.lastChar);
|
||||
}
|
||||
|
||||
readToUnicode(cmapObj) {
|
||||
async readToUnicode(cmapObj) {
|
||||
if (!cmapObj) {
|
||||
return Promise.resolve(null);
|
||||
return null;
|
||||
}
|
||||
if (cmapObj instanceof Name) {
|
||||
return CMapFactory.create({
|
||||
const cmap = await CMapFactory.create({
|
||||
encoding: cmapObj,
|
||||
fetchBuiltInCMap: this._fetchBuiltInCMapBound,
|
||||
useCMap: null,
|
||||
}).then(function (cmap) {
|
||||
});
|
||||
|
||||
if (cmap instanceof IdentityCMap) {
|
||||
return new IdentityToUnicodeMap(0, 0xffff);
|
||||
}
|
||||
return new ToUnicodeMap(cmap.getMap());
|
||||
});
|
||||
} else if (cmapObj instanceof BaseStream) {
|
||||
return CMapFactory.create({
|
||||
}
|
||||
if (cmapObj instanceof BaseStream) {
|
||||
try {
|
||||
const cmap = await CMapFactory.create({
|
||||
encoding: cmapObj,
|
||||
fetchBuiltInCMap: this._fetchBuiltInCMapBound,
|
||||
useCMap: null,
|
||||
}).then(
|
||||
function (cmap) {
|
||||
});
|
||||
|
||||
if (cmap instanceof IdentityCMap) {
|
||||
return new IdentityToUnicodeMap(0, 0xffff);
|
||||
}
|
||||
@ -3815,8 +3817,7 @@ class PartialEvaluator {
|
||||
map[charCode] = String.fromCodePoint(...str);
|
||||
});
|
||||
return new ToUnicodeMap(map);
|
||||
},
|
||||
reason => {
|
||||
} catch (reason) {
|
||||
if (reason instanceof AbortException) {
|
||||
return null;
|
||||
}
|
||||
@ -3826,9 +3827,8 @@ class PartialEvaluator {
|
||||
}
|
||||
throw reason;
|
||||
}
|
||||
);
|
||||
}
|
||||
return Promise.resolve(null);
|
||||
return null;
|
||||
}
|
||||
|
||||
readCidToGidMap(glyphsData, toUnicode) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user