]> git.parisson.com Git - pdf.js.git/commitdiff
Address review comments of #409
authorVivien Nicolas <21@vingtetun.org>
Wed, 31 Aug 2011 11:42:10 +0000 (13:42 +0200)
committerVivien Nicolas <21@vingtetun.org>
Wed, 31 Aug 2011 11:42:10 +0000 (13:42 +0200)
fonts.js

index 0d3c63c82ea751d844da04803ac9e3a61fe55ea7..24fd35d61bb97937796281e211b8491f36008e0c 100755 (executable)
--- a/fonts.js
+++ b/fonts.js
@@ -415,10 +415,8 @@ var Font = (function Font() {
         this.mimetype = 'font/opentype';
 
         var subtype = properties.subtype;
-        if (subtype === 'Type1C')
-          var cff = new Type2CFF(file, properties);
-        else
-          var cff = new CFF(name, file, properties);
+        var cff = (subtype === 'Type1C') ? new Type2CFF(file, properties)
+                                         : new CFF(name, file, properties);
 
         // Wrap the CFF data inside an OTF font file
         data = this.convert(name, cff, properties);
@@ -2161,16 +2159,16 @@ var Type2CFF = (function() {
 
       var bytes = this.bytes;
 
-      var privateInfo = topDict['Private'];
+      var privateInfo = topDict.Private;
       var privOffset = privateInfo[1], privLength = privateInfo[0];
       var privBytes = bytes.subarray(privOffset, privOffset + privLength);
       baseDict = this.parseDict(privBytes);
       var privDict = this.getPrivDict(baseDict, strings);
 
-      var charStrings = this.parseIndex(topDict['CharStrings']);
-      var charset = this.parseCharsets(topDict['charset'],
+      var charStrings = this.parseIndex(topDict.CharStrings);
+      var charset = this.parseCharsets(topDict.charset,
                                        charStrings.length, strings);
-      var hasSupplement = this.parseEncoding(topDict['Encoding'], properties, 
+      var hasSupplement = this.parseEncoding(topDict.Encoding, properties, 
                                              strings, charset);
 
       // The font sanitizer does not support CFF encoding with a
@@ -2179,7 +2177,7 @@ var Type2CFF = (function() {
       // the top dictionary to let the sanitizer think the font use
       // StandardEncoding, that's a lie but that's ok.
       if (hasSupplement)
-        bytes[topDict['Encoding']] = 0;
+        bytes[topDict.Encoding] = 0;
 
       // charstrings contains info about glyphs (one element per glyph
       // containing mappings for {unicode, width})
@@ -2258,7 +2256,6 @@ var Type2CFF = (function() {
             encoding[index] = gid++;
         }
       } else {
-
         var format = bytes[pos++];
         switch (format & 0x7f) {
           case 0: