Merge pull request #2913 from yurydelendik/combine-os2valid
Removes isOS2Valid; resets fsType
This commit is contained in:
commit
1f9b28f3f6
24
src/fonts.js
24
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;
|
||||
|
Loading…
Reference in New Issue
Block a user