]> git.parisson.com Git - pdf.js.git/commitdiff
removed code to parse type2 ccharstrings
authorsbarman <sbarman@L3CWZ5T.(none)>
Wed, 20 Jul 2011 21:43:44 +0000 (14:43 -0700)
committersbarman <sbarman@L3CWZ5T.(none)>
Wed, 20 Jul 2011 21:43:44 +0000 (14:43 -0700)
fonts.js
pdf.js

index 7ca0daa3007b88b6b0fccc19a528d3fa52334499..5d77f8980aca009f0221d1a6fc472d6164429329 100755 (executable)
--- a/fonts.js
+++ b/fonts.js
@@ -408,6 +408,8 @@ var Font = (function() {
             var width = widths[unicode];
             if (width)
               charstring.width = width;
+            else
+              charstring.width = 0;
           }
         }
 
@@ -2067,45 +2069,11 @@ var Type2CFF = (function() {
         var charName = charsets[i];
         var charCode = GlyphsUnicode[charName];
         if (charCode) {
-          var charString = this.parseCharString(charStrings.get(i),
-              defaultWidth, nominalWidth);
-          charstrings.push({unicode: charCode, width: charString.width});
+          charstrings.push({unicode: charCode, width: 0});
         }
       }
       return charstrings;
     },
-    parseCharString: function cff_parsecs(bytes, defaultWidth, nominalWidth) {
-      var pos = 0;
-      
-      function parseInt() {
-        var value = bytes[pos++];
-        if (value < 32)
-          return null;
-
-        if (value <= 246) {
-          return value - 139;
-        } else if (value <= 250) {
-          return ((value - 247) * 256) + bytes[pos++] + 108;
-        } else if (value <= 254) {
-          return -((value - 251) * 256) - bytes[pos++] - 108;
-        } else {
-          error('Incorrect byte');
-        }
-      };
-      
-      var val = bytes[pos];
-      var w;
-      if (val >= 32 && val <= 254) {
-        w = parseInt();
-      }
-
-      if (w)
-        w += nominalWidth;
-      else
-        w = defaultWidth;
-
-      return {width: w}
-    },
     parseEncoding: function cff_parseencoding(pos) {
       if (pos == 0) {
         return Encodings.StandardEncoding;
diff --git a/pdf.js b/pdf.js
index 8e30858bfc8a59a897efae73bca97fe7aea48dd2..d38f7391f0619cc717c611c52562f142d84f1c52 100644 (file)
--- a/pdf.js
+++ b/pdf.js
@@ -3821,15 +3821,11 @@ var PartialEvaluator = (function() {
       }
 
       var widths = fontDict.get('Widths');
-      var firstChar = fontDict.get('FirstChar');
-      var lastChar = fontDict.get('LastChar');
       if (widths) {
-        var glyphWidths = [];
-        for (var i = 0; i < firstChar; ++i)
-          glyphWidths.push(0);
-        
+        var glyphWidths = {};
+        var unicode = fontDict.get('FirstChar');
         for (var i = 0, ii = widths.length; i < ii; ++i)
-          glyphWidths.push(widths[i]);
+          glyphWidths[unicode++] = widths[i];
       }
 
       var properties = {