mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-04-15 09:44:03 +02:00
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:
parent
4d0709c174
commit
aa445877a9
@ -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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user