[_h_m_t_x] warn if hhea.numberOfHMetrics > maxp.numGlyphs

the comment said "We warn later" but that's not true.
This commit is contained in:
Cosimo Lupo 2016-10-13 19:49:33 +01:00
parent c8901bf940
commit ca6beadd22

View File

@ -24,7 +24,9 @@ class table__h_m_t_x(DefaultTable.DefaultTable):
numGlyphs = ttFont['maxp'].numGlyphs
numberOfMetrics = int(getattr(ttFont[self.headerTag], self.numberOfMetricsName))
if numberOfMetrics > numGlyphs:
numberOfMetrics = numGlyphs # We warn later.
log.warning("The %s.%s exceeds the maxp.numGlyphs" % (
self.headerTag, self.numberOfMetricsName))
numberOfMetrics = numGlyphs
if len(data) < 4 * numberOfMetrics:
raise ttLib.TTLibError("not enough '%s' table data" % self.tableTag)
# Note: advanceWidth is unsigned, but some font editors might