]> git.parisson.com Git - pdf.js.git/commitdiff
make cmap glyph offset a symbolic constant
authorAdil Allawi <adil@diwan.com>
Fri, 19 Aug 2011 20:51:57 +0000 (21:51 +0100)
committerAdil Allawi <adil@diwan.com>
Fri, 19 Aug 2011 20:51:57 +0000 (21:51 +0100)
fonts.js

index 1aff9eb0e54d4c74db8b3cf4aafcca9c354f51ef..8b33ca3fc400aec07c346d87c63b3d4ad550bc66 100755 (executable)
--- a/fonts.js
+++ b/fonts.js
@@ -790,6 +790,8 @@ var Font = (function Font() {
     encoding: null,
 
     checkAndRepair: function font_checkAndRepair(name, font, properties) {
+      var kCmapGlyphOffset = 0xFF;
+
       function readTableEntry(file) {
         // tag
         var tag = file.getBytes(4);
@@ -1042,17 +1044,17 @@ var Font = (function Font() {
         var encoding = properties.encoding;
 
         for (var i = 1; i < numGlyphs; i++) {
-          glyphs.push({ unicode: i + 0xFF });
+          glyphs.push({ unicode: i + kCmapGlyphOffset });
         }
 
         if ('undefined' == typeof(encoding[0])) {
           // the font is directly characters to glyphs with no encoding
           // so create an identity encoding
           for (i = 0; i < numGlyphs; i++)
-            encoding[i] = i + 0xFF;
+            encoding[i] = i + kCmapGlyphOffset;
         } else {
           for (var i in encoding)
-            encoding[i] = encoding[i] + 0xFF;
+            encoding[i] = encoding[i] + kCmapGlyphOffset;
         }
 
         if (!cmap) {