]> git.parisson.com Git - pdf.js.git/commitdiff
Address review comment for pull #419
authorVivien Nicolas <21@vingtetun.org>
Wed, 31 Aug 2011 23:16:40 +0000 (01:16 +0200)
committerVivien Nicolas <21@vingtetun.org>
Wed, 31 Aug 2011 23:16:40 +0000 (01:16 +0200)
fonts.js
pdf.js

index adf0a48e3ed992077b9abb399c45249f840e9a45..6488c073baacab79ab1d0e3b77938f0eea33b96c 100755 (executable)
--- a/fonts.js
+++ b/fonts.js
@@ -2207,32 +2207,29 @@ var Type2CFF = (function() {
       var nominalWidth = privDict['nominalWidthX'];
 
       var charstrings = [];
-      var differences = properties.differences;
-      var index = 0, code = 0;
       var kCmapGlyphOffset = 0xE000;
+      var differences = properties.differences;
+      var index = 0;
       for (var i = 1; i < charsets.length; i++) {
+        var code = -1;
         var glyph = charsets[i];
-        if (differences.length) {
-          for (var j = index; j < differences.length; j++) {
-            if (differences[j]) {
-              index = j;
-              break;
-            }
+        for (var j = index; j < differences.length; j++) {
+          if (differences[j]) {
+            index = j;
+            code = differences.indexOf(glyph);
+            break;
           }
-
-          code = differences.indexOf(glyph);
-          if (code == -1)
-            code = properties.glyphs[glyph] || index;
-        } else {
-          code = GlyphsUnicode[glyph] || index;
-          index = code;
         }
 
-        if (!code)
-          continue;
+        if (code == -1)
+          index = code = properties.glyphs[glyph] || index;
+
         var width = widths[code] || defaultWidth;
         properties.encoding[index] = index + kCmapGlyphOffset;
-        charstrings.push({unicode: code + kCmapGlyphOffset, width: width, gid: i});
+        charstrings.push({
+          unicode: code + kCmapGlyphOffset,
+          width: width, gid: i
+        });
         index++;
       }
 
diff --git a/pdf.js b/pdf.js
index 1a586e48afbc29e172019802ed52ca5f850a0ee3..df8871e7fce427f01580ac894dbdd44f33448347 100644 (file)
--- a/pdf.js
+++ b/pdf.js
@@ -4281,10 +4281,6 @@ var PartialEvaluator = (function() {
             case 'Type1':
               baseEncoding = Encodings.StandardEncoding.slice();
               break;
-            case 'Type3':
-              // There is no baseEncoding for a Type3 font, the 'Encoding'
-              // entry is required and should provide a complete encoding
-              break;
             default:
               warn('Unknown type of font: ' + fontType);
               break;
@@ -4308,10 +4304,6 @@ var PartialEvaluator = (function() {
             glyphsMap[glyph] = encodingMap[i] = GlyphsUnicode[glyph] || i;
         }
 
-        
-        if (fontType == 'Type3')
-        log(glyphsMap);
-
         if (fontType == 'TrueType' && fontDict.has('ToUnicode') && differences) {
           var cmapObj = xref.fetchIfRef(fontDict.get('ToUnicode'));
           if (IsName(cmapObj)) {