]> git.parisson.com Git - pdf.js.git/commitdiff
Fix review comments from #424
authorVivien Nicolas <21@vingtetun.org>
Tue, 6 Sep 2011 22:19:58 +0000 (00:19 +0200)
committerVivien Nicolas <21@vingtetun.org>
Tue, 6 Sep 2011 22:19:58 +0000 (00:19 +0200)
fonts.js

index f53a2098b702fce1d707f8d8ca0316ac66931fda..8c4638a3b9cfa4d700f2629c2842f061c2e51328 100755 (executable)
--- a/fonts.js
+++ b/fonts.js
@@ -858,6 +858,11 @@ var Font = (function Font() {
         }
 
         // Check that table are sorted by platformID then encodingID,
+        records.sort(function(a, b) {
+          return ((a.platformID << 16) + a.encodingID) -
+                 ((b.platformID << 16) + b.encodingID)
+        });
+
         var tables = [records[0]];
         for (var i = 1; i < numRecords; i++) {
           // The sanitizer will drop the font if 2 tables have the same
@@ -875,7 +880,7 @@ var Font = (function Font() {
         }
 
         var missing = numRecords - tables.length;
-        if (numRecords - tables.length) {
+        if (missing) {
           numRecords = tables.length;
           var data = string16(version) + string16(numRecords);