From 246301acc9a54c38f83dcbc9b15127edff33b804 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 14 Nov 2013 18:55:35 -0500 Subject: [PATCH] Fixup hhea recalc after 9222b8ef93fd6b41f9c4dcf152593cd0c80f0ba4 --- Lib/fontTools/ttLib/tables/_h_h_e_a.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/Lib/fontTools/ttLib/tables/_h_h_e_a.py b/Lib/fontTools/ttLib/tables/_h_h_e_a.py index e614448fb..6cb45c33b 100644 --- a/Lib/fontTools/ttLib/tables/_h_h_e_a.py +++ b/Lib/fontTools/ttLib/tables/_h_h_e_a.py @@ -42,7 +42,7 @@ class table__h_h_e_a(DefaultTable.DefaultTable): if ttFont.has_key('glyf'): glyfTable = ttFont['glyf'] INFINITY = 100000 - advanceWidthMax = -INFINITY # arbitrary big negative number + advanceWidthMax = 0 minLeftSideBearing = +INFINITY # arbitrary big number minRightSideBearing = +INFINITY # arbitrary big number xMaxExtent = -INFINITY # arbitrary big negative number @@ -62,18 +62,17 @@ class table__h_h_e_a(DefaultTable.DefaultTable): minRightSideBearing = min(minRightSideBearing, rsb) extent = lsb + (g.xMax - g.xMin) xMaxExtent = max(xMaxExtent, extent) - if advanceWidthMax == -INFINITY: - self.advanceWidthMax = 0 - else: - self.advanceWidthMax = advanceWidthMax + if xMaxExtent == -INFINITY: - self.minLeftSideBearing = 0 - self.minRightSideBearing = 0 - self.xMaxExtent = 0 - else: - self.minLeftSideBearing = minLeftSideBearing - self.minRightSideBearing = minRightSideBearing - self.xMaxExtent = xMaxExtent + # No glyph has outlines. + minLeftSideBearing = 0 + minRightSideBearing = 0 + xMaxExtent = 0 + + self.advanceWidthMax = advanceWidthMax + self.minLeftSideBearing = minLeftSideBearing + self.minRightSideBearing = minRightSideBearing + self.xMaxExtent = xMaxExtent else: # XXX CFF recalc... pass