]> git.parisson.com Git - pdf.js.git/commitdiff
Move all format 0 characters to the private area
authorVivien Nicolas <21@vingtetun.org>
Mon, 5 Sep 2011 15:30:01 +0000 (17:30 +0200)
committerVivien Nicolas <21@vingtetun.org>
Mon, 5 Sep 2011 15:30:01 +0000 (17:30 +0200)
fonts.js
pdf.js

index 231124783f10e270e7c3a59ea303611e2299e793..03b87a84f71cef9da038ac79aab31af687006548 100755 (executable)
--- a/fonts.js
+++ b/fonts.js
@@ -12,7 +12,6 @@ var kMaxWaitForFontFace = 1000;
 // Unicode Private Use Area
 var kCmapGlyphOffset = 0xE000;
 
-
 /**
  * Hold a map of decoded fonts and of the standard fourteen Type1
  * fonts and their acronyms.
@@ -887,16 +886,9 @@ var Font = (function Font() {
                     break;
                 }
 
-                glyphs.push({ glyph: glyph, unicode: j });
-              }
-            }
-
-            if (properties.firstChar < 0x20) {
-              for (var j = 0; j < glyphs.length; j++) {
-                var glyph = glyphs[j];
-                var code = glyph.unicode + kCmapGlyphOffset;
-                properties.glyphs[glyph.glyph] = encoding[glyph.unicode] = code;
-                glyph.unicode = code;
+                var unicode = j + kCmapGlyphOffset;
+                properties.glyphs[glyph] = encoding[j] = unicode;
+                glyphs.push({ glyph: glyph, unicode: unicode });
               }
             }
             
diff --git a/pdf.js b/pdf.js
index dcc9f8887cecb8cac47938cfb6a31ac73b0f0656..2d05295c166bc6b9a8ff8ec765c9865ab26950d4 100644 (file)
--- a/pdf.js
+++ b/pdf.js
@@ -4297,6 +4297,10 @@ var PartialEvaluator = (function() {
           lastChar = diffEncoding.length || baseEncoding.length;
 
         // merge in the differences
+        function isDisplayable(code) {
+          return code > 0x1f && (code < 128 || code > 255);
+        }
+
         var glyphsMap = {};
         for (var i = firstChar; i <= lastChar; i++) {
           var glyph = diffEncoding[i] || baseEncoding[i];
@@ -4304,7 +4308,7 @@ var PartialEvaluator = (function() {
             var index = GlyphsUnicode[glyph] || i;
             glyphsMap[glyph] = encodingMap[i] = index;
 
-            if (index <= 0x1f || (index >= 127 && index <= 255))
+            if (!isDisplayable(index))
               glyphsMap[glyph] = encodingMap[i] += kCmapGlyphOffset;
             
           }