more cosmetics

git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@227 4cde692c-a291-49d1-8350-778aa11640f8
This commit is contained in:
jvr 2002-05-13 18:08:19 +00:00
parent 8307fa42cd
commit e69caf8771
2 changed files with 24 additions and 22 deletions

View File

@ -2,33 +2,35 @@ import DefaultTable
import sstruct import sstruct
from fontTools.misc.textTools import safeEval from fontTools.misc.textTools import safeEval
hheaFormat = """ hheaFormat = """
> # big endian > # big endian
tableVersion: 16.16F tableVersion: 16.16F
ascent: h ascent: h
descent: h descent: h
lineGap: h lineGap: h
advanceWidthMax: H advanceWidthMax: H
minLeftSideBearing: h minLeftSideBearing: h
minRightSideBearing: h minRightSideBearing: h
xMaxExtent: h xMaxExtent: h
caretSlopeRise: h caretSlopeRise: h
caretSlopeRun: h caretSlopeRun: h
reserved0: h reserved0: h
reserved1: h reserved1: h
reserved2: h reserved2: h
reserved3: h reserved3: h
reserved4: h reserved4: h
metricDataFormat: h metricDataFormat: h
numberOfHMetrics: H numberOfHMetrics: H
""" """
class table__h_h_e_a(DefaultTable.DefaultTable): class table__h_h_e_a(DefaultTable.DefaultTable):
dependencies = ['hmtx', 'glyf'] dependencies = ['hmtx', 'glyf']
def decompile(self, data, ttFont): def decompile(self, data, ttFont):
sstruct.unpack(hheaFormat, data, self) sstruct.unpack(hheaFormat, data.read(), self)
def compile(self, ttFont): def compile(self, ttFont):
if ttFont.isLoaded('glyf') and ttFont.recalcBBoxes: if ttFont.isLoaded('glyf') and ttFont.recalcBBoxes:

View File

@ -62,21 +62,21 @@ class OTTableReader:
def readUShort(self): def readUShort(self):
pos = self.pos pos = self.pos
newpos = pos + 2 newpos = pos + 2
value = struct.unpack(">H", self.data[pos:newpos])[0] value, = struct.unpack(">H", self.data[pos:newpos])
self.pos = newpos self.pos = newpos
return value return value
def readShort(self): def readShort(self):
pos = self.pos pos = self.pos
newpos = pos + 2 newpos = pos + 2
value = struct.unpack(">h", self.data[pos:newpos])[0] value, = struct.unpack(">h", self.data[pos:newpos])
self.pos = newpos self.pos = newpos
return value return value
def readLong(self): def readLong(self):
pos = self.pos pos = self.pos
newpos = pos + 4 newpos = pos + 4
value = struct.unpack(">l", self.data[pos:newpos])[0] value, = struct.unpack(">l", self.data[pos:newpos])
self.pos = newpos self.pos = newpos
return value return value