Use BaseStream.prototype.getString in the readPostScriptTable function

Currently the `customNames` are read one byte at a time, in a loop, and at every iteration converted to a string.
This can be replaced with the `BaseStream.prototype.getString` method, which didn't exist back when this function was written.
This commit is contained in:
Jonas Jenwald 2026-03-04 18:34:07 +01:00
parent 4d0709c174
commit aa445877a9

View File

@ -2255,15 +2255,11 @@ class Font {
if (!valid) {
break;
}
const customNames = [],
strBuf = [];
const customNames = [];
while (font.pos < end) {
const stringLength = font.getByte();
strBuf.length = stringLength;
for (i = 0; i < stringLength; ++i) {
strBuf[i] = String.fromCharCode(font.getByte());
}
customNames.push(strBuf.join(""));
const strLen = font.getByte(),
str = font.getString(strLen);
customNames.push(str);
}
glyphNames = [];
for (i = 0; i < numGlyphs; ++i) {