Use Array.join to build up strings in readPostScriptTable().
This avoids about 5 MiB of string allocations on one test case.
This commit is contained in:
parent
584fef90ab
commit
1039791472
@ -3430,13 +3430,14 @@ var Font = (function FontClosure() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
var customNames = [];
|
var customNames = [];
|
||||||
|
var strBuf = [];
|
||||||
while (font.pos < end) {
|
while (font.pos < end) {
|
||||||
var stringLength = font.getByte();
|
var stringLength = font.getByte();
|
||||||
var string = '';
|
strBuf.length = stringLength;
|
||||||
for (i = 0; i < stringLength; ++i) {
|
for (i = 0; i < stringLength; ++i) {
|
||||||
string += String.fromCharCode(font.getByte());
|
strBuf[i] = String.fromCharCode(font.getByte());
|
||||||
}
|
}
|
||||||
customNames.push(string);
|
customNames.push(strBuf.join(''));
|
||||||
}
|
}
|
||||||
glyphNames = [];
|
glyphNames = [];
|
||||||
for (i = 0; i < numGlyphs; ++i) {
|
for (i = 0; i < numGlyphs; ++i) {
|
||||||
|
Loading…
Reference in New Issue
Block a user