mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-25 00:17:21 +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) {
|
if (!valid) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
const customNames = [],
|
const customNames = [];
|
||||||
strBuf = [];
|
|
||||||
while (font.pos < end) {
|
while (font.pos < end) {
|
||||||
const stringLength = font.getByte();
|
const strLen = font.getByte(),
|
||||||
strBuf.length = stringLength;
|
str = font.getString(strLen);
|
||||||
for (i = 0; i < stringLength; ++i) {
|
customNames.push(str);
|
||||||
strBuf[i] = String.fromCharCode(font.getByte());
|
|
||||||
}
|
|
||||||
customNames.push(strBuf.join(""));
|
|
||||||
}
|
}
|
||||||
glyphNames = [];
|
glyphNames = [];
|
||||||
for (i = 0; i < numGlyphs; ++i) {
|
for (i = 0; i < numGlyphs; ++i) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user