From 0e062668e9252a30918ec80d55e33bb5be1d13df Mon Sep 17 00:00:00 2001 From: Vivien Nicolas <21@vingtetun.org> Date: Wed, 7 Sep 2011 00:19:58 +0200 Subject: [PATCH] Fix review comments from #424 --- fonts.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fonts.js b/fonts.js index f53a2098b..8c4638a3b 100755 --- 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);