1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

Use Array.join() to build up strings in more places.

This commit is contained in:
Nicholas Nethercote 2014-02-27 15:23:56 -08:00
parent cab5d7b96f
commit ab7568c0ff
3 changed files with 27 additions and 22 deletions

View file

@ -2382,11 +2382,11 @@ var Font = (function FontClosure() {
}
function arrayToString(arr) {
var str = '';
for (var i = 0, ii = arr.length; i < ii; ++i)
str += String.fromCharCode(arr[i]);
return str;
var strBuf = [];
for (var i = 0, ii = arr.length; i < ii; ++i) {
strBuf.push(String.fromCharCode(arr[i]));
}
return strBuf.join('');
}
function int16(bytes) {
@ -2801,10 +2801,11 @@ var Font = (function FontClosure() {
for (var i = 0, ii = strings.length; i < ii; i++) {
var str = proto[1][i] || strings[i];
var strUnicode = '';
for (var j = 0, jj = str.length; j < jj; j++)
strUnicode += string16(str.charCodeAt(j));
stringsUnicode.push(strUnicode);
var strBufUnicode = [];
for (var j = 0, jj = str.length; j < jj; j++) {
strBufUnicode.push(string16(str.charCodeAt(j)));
}
stringsUnicode.push(strBufUnicode.join(''));
}
var names = [strings, stringsUnicode];