diff --git a/Lib/fontTools/ttLib/tables/_h_h_e_a.py b/Lib/fontTools/ttLib/tables/_h_h_e_a.py index d8d297a91..fae53a6db 100644 --- a/Lib/fontTools/ttLib/tables/_h_h_e_a.py +++ b/Lib/fontTools/ttLib/tables/_h_h_e_a.py @@ -2,33 +2,35 @@ import DefaultTable import sstruct from fontTools.misc.textTools import safeEval + hheaFormat = """ - > # big endian - tableVersion: 16.16F - ascent: h - descent: h - lineGap: h - advanceWidthMax: H - minLeftSideBearing: h - minRightSideBearing: h - xMaxExtent: h - caretSlopeRise: h - caretSlopeRun: h - reserved0: h - reserved1: h - reserved2: h - reserved3: h - reserved4: h - metricDataFormat: h - numberOfHMetrics: H + > # big endian + tableVersion: 16.16F + ascent: h + descent: h + lineGap: h + advanceWidthMax: H + minLeftSideBearing: h + minRightSideBearing: h + xMaxExtent: h + caretSlopeRise: h + caretSlopeRun: h + reserved0: h + reserved1: h + reserved2: h + reserved3: h + reserved4: h + metricDataFormat: h + numberOfHMetrics: H """ + class table__h_h_e_a(DefaultTable.DefaultTable): dependencies = ['hmtx', 'glyf'] def decompile(self, data, ttFont): - sstruct.unpack(hheaFormat, data, self) + sstruct.unpack(hheaFormat, data.read(), self) def compile(self, ttFont): if ttFont.isLoaded('glyf') and ttFont.recalcBBoxes: diff --git a/Lib/fontTools/ttLib/tables/otBase.py b/Lib/fontTools/ttLib/tables/otBase.py index 05033fa7d..d7a06b4eb 100644 --- a/Lib/fontTools/ttLib/tables/otBase.py +++ b/Lib/fontTools/ttLib/tables/otBase.py @@ -62,21 +62,21 @@ class OTTableReader: def readUShort(self): pos = self.pos newpos = pos + 2 - value = struct.unpack(">H", self.data[pos:newpos])[0] + value, = struct.unpack(">H", self.data[pos:newpos]) self.pos = newpos return value def readShort(self): pos = self.pos newpos = pos + 2 - value = struct.unpack(">h", self.data[pos:newpos])[0] + value, = struct.unpack(">h", self.data[pos:newpos]) self.pos = newpos return value def readLong(self): pos = self.pos newpos = pos + 4 - value = struct.unpack(">l", self.data[pos:newpos])[0] + value, = struct.unpack(">l", self.data[pos:newpos]) self.pos = newpos return value