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:
parent
8307fa42cd
commit
e69caf8771
@ -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:
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user