From ad3390c24cd775190c3231561b4b7ac3fbbd194b Mon Sep 17 00:00:00 2001 From: Yury Delendik Date: Fri, 8 Mar 2013 14:11:12 -0600 Subject: [PATCH] Removes isOS2Valid; resets fsType --- src/fonts.js | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/src/fonts.js b/src/fonts.js index 5fbac58b1389a..68c4eefbc615d 100644 --- a/src/fonts.js +++ b/src/fonts.js @@ -2784,6 +2784,14 @@ var Font = (function FontClosure() { if (firstChar > lastChar) { return false; } + stream.getBytes(6); // skipping sTypoAscender/Descender/LineGap + var usWinAscent = int16(stream.getBytes(2)); + if (usWinAscent === 0) { // makes font unreadable by windows + return false; + } + + // OS/2 appears to be valid, resetting some fields + os2.data[8] = os2.data[9] = 0; // IE rejects fonts if fsType != 0 return true; } @@ -3633,16 +3641,6 @@ var Font = (function FontClosure() { return names; } - function isOS2Valid(os2Table) { - var data = os2Table.data; - // usWinAscent == 0 makes font unreadable by windows - var usWinAscent = (data[74] << 8) | data[75]; - if (usWinAscent === 0) - return false; - - return true; - } - var TTOpsStackDeltas = [ 0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -2, -2, 0, 0, -2, -5, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, -1, -1, @@ -3837,12 +3835,6 @@ var Font = (function FontClosure() { // of missing tables createOpenTypeHeader(header.version, ttf, numTables); - // Invalid OS/2 can break the font for the Windows - if (os2 && !isOS2Valid(os2)) { - tables.splice(tables.indexOf(os2), 1); - os2 = null; - } - // Ensure the hmtx table contains the advance width and // sidebearings information for numGlyphs in the maxp table font.pos = (font.start || 0) + maxp.offset;