]> git.parisson.com Git - pdf.js.git/commitdiff
Merge branch 'master' of https://github.com/andreasgal/pdf.js.git into cff-issues
authornotmasteryet <async.processingjs@yahoo.com>
Wed, 6 Jul 2011 13:16:07 +0000 (08:16 -0500)
committernotmasteryet <async.processingjs@yahoo.com>
Wed, 6 Jul 2011 13:16:07 +0000 (08:16 -0500)
Conflicts:
fonts.js

1  2 
fonts.js

diff --cc fonts.js
index 2243a22be48ac9b0d4303809b782826476cb4e17,d00d114dbac97d6b24bd93217f856ccfa88804b1..d85d40b2f2871063c0910a9311b21988ccc7e830
mode 100755,100644..100755
+++ 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);
  
      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;
    },