From e69caf8771a0dd675ca3c4490625dac963a6b65c Mon Sep 17 00:00:00 2001 From: jvr Date: Mon, 13 May 2002 18:08:19 +0000 Subject: [PATCH] more cosmetics git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@227 4cde692c-a291-49d1-8350-778aa11640f8 --- Lib/fontTools/ttLib/tables/_h_h_e_a.py | 40 ++++++++++++++------------ Lib/fontTools/ttLib/tables/otBase.py | 6 ++-- 2 files changed, 24 insertions(+), 22 deletions(-) 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