From: notmasteryet Date: Wed, 6 Jul 2011 13:16:07 +0000 (-0500) Subject: Merge branch 'master' of https://github.com/andreasgal/pdf.js.git into cff-issues X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=4169fe151d7efd6ed14553fea9c670b7857780f7;p=pdf.js.git Merge branch 'master' of https://github.com/andreasgal/pdf.js.git into cff-issues Conflicts: fonts.js --- 4169fe151d7efd6ed14553fea9c670b7857780f7 diff --cc fonts.js index 2243a22,d00d114..d85d40b mode 100755,100644..100755 --- a/fonts.js +++ b/fonts.js @@@ -537,11 -537,12 +537,12 @@@ var Font = (function() offsets.virtualOffset++; // checksum - var checksum = 0; - for (var i = 0; i < length; i += 4) - checksum += int16([data[i], data[i + 1], data[i + 2], data[i + 3]]); + var checksum = 0, n = data.length; + for (var i = 0; i < n; i+=4) + checksum = (checksum + int32([data[i], data[i+1], data[i+2], data[i+3]])) | 0; - var tableEntry = tag + string32(checksum) + string32(offset) + string32(length); + var tableEntry = (tag + string32(checksum) + + string32(offset) + string32(length)); tableEntry = stringToArray(tableEntry); file.set(tableEntry, offsets.currentOffset); @@@ -638,19 -639,19 +639,19 @@@ var ulUnicodeRange3 = 0; var ulUnicodeRange4 = 0; - var charset = properties.charset; + var charset = properties.charset; if (charset && charset.length) { - var firstCharIndex = null; - var lastCharIndex = 0; + var firstCharIndex = null; + var lastCharIndex = 0; - for (var i = 1; i < charset.length; i++) { + for (var i = 0; i < charset.length; i++) { - var code = GlyphsUnicode[charset[i]]; - if (firstCharIndex > code || !firstCharIndex) - firstCharIndex = code; - if (lastCharIndex < code) - lastCharIndex = code; + var code = GlyphsUnicode[charset[i]]; + if (firstCharIndex > code || !firstCharIndex) + firstCharIndex = code; + if (lastCharIndex < code) + lastCharIndex = code; - var position = getUnicodeRangeFor(code); + var position = getUnicodeRangeFor(code); if (position < 32) { ulUnicodeRange1 |= 1 << position; } else if (position < 64) { @@@ -1610,26 -1632,26 +1632,26 @@@ CFF.prototype = relativeOffset += objects[i].length; } - for (var i =0; i < count; i++) { + for (var i = 0; i < count; i++) { for (var j = 0; j < objects[i].length; j++) - data += isByte ? String.fromCharCode(objects[i][j]) : objects[i][j]; + data += isByte ? String.fromCharCode(objects[i][j] & 0xFF) : objects[i][j]; } return data; }, encodeNumber: function cff_encodeNumber(value) { if (value >= -32768 && value <= 32767) { - return "\x1c" + + return '\x1c' + - String.fromCharCode(value >> 8) + + String.fromCharCode((value >> 8) & 0xFF) + String.fromCharCode(value & 0xFF); - } else if (value >= (-2147483647 - 1) && value <= 2147483647) { + } else if (value >= (-2147483647-1) && value <= 2147483647) { - return "\xff" + + return '\xff' + - String.fromCharCode(value >> 24) + - String.fromCharCode(value >> 16) + - String.fromCharCode(value >> 8) + + String.fromCharCode((value >>> 24) & 0xFF) + + String.fromCharCode((value >> 16) & 0xFF) + + String.fromCharCode((value >> 8) & 0xFF) + String.fromCharCode(value & 0xFF); } - error("Value: " + value + " is not allowed"); + error('Value: ' + value + ' is not allowed'); return null; },