Fixes invalid maxZones value

This commit is contained in:
Yury Delendik 2013-11-02 18:16:24 -05:00
parent 768a86d59d
commit cf55d69c38

View File

@ -3706,7 +3706,14 @@ var Font = (function FontClosure() {
var numGlyphs = int16(font.getBytes(2));
var maxFunctionDefs = 0;
if (version >= 0x00010000 && tables.maxp.length >= 22) {
font.pos += 14;
// maxZones can be invalid
font.pos += 8;
var maxZones = int16(font.getBytes(2));
if (maxZones > 2) { // reset to 2 if font has invalid maxZones
tables.maxp.data[14] = 0;
tables.maxp.data[15] = 2;
}
font.pos += 4;
maxFunctionDefs = int16(font.getBytes(2));
}