Skip to content

Commit 7e48938

Browse files
Merge pull request #20799 from Snuffleupagus/readPostScriptTable-getString
Use `BaseStream.prototype.getString` in the `readPostScriptTable` function
2 parents 874ba23 + aa44587 commit 7e48938

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

src/core/fonts.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2255,15 +2255,11 @@ class Font {
22552255
if (!valid) {
22562256
break;
22572257
}
2258-
const customNames = [],
2259-
strBuf = [];
2258+
const customNames = [];
22602259
while (font.pos < end) {
2261-
const stringLength = font.getByte();
2262-
strBuf.length = stringLength;
2263-
for (i = 0; i < stringLength; ++i) {
2264-
strBuf[i] = String.fromCharCode(font.getByte());
2265-
}
2266-
customNames.push(strBuf.join(""));
2260+
const strLen = font.getByte(),
2261+
str = font.getString(strLen);
2262+
customNames.push(str);
22672263
}
22682264
glyphNames = [];
22692265
for (i = 0; i < numGlyphs; ++i) {

0 commit comments

Comments
 (0)