added recalcBBoxes argument to Glyph.compile()

git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@11 4cde692c-a291-49d1-8350-778aa11640f8
This commit is contained in:
Just 1999-12-18 18:08:07 +00:00
parent 88cb4f33c6
commit e4d59426c5

View File

@ -47,9 +47,10 @@ class table__g_l_y_f(DefaultTable.DefaultTable):
locations = []
currentLocation = 0
dataList = []
recalcBBoxes = ttFont.recalcBBoxes
for glyphName in ttFont.getGlyphOrder():
glyph = self[glyphName]
glyphData = glyph.compile(self)
glyphData = glyph.compile(self, recalcBBoxes)
locations.append(currentLocation)
currentLocation = currentLocation + len(glyphData)
dataList.append(glyphData)
@ -59,7 +60,7 @@ class table__g_l_y_f(DefaultTable.DefaultTable):
ttFont['maxp'].numGlyphs = len(self.glyphs)
return data
def toXML(self, writer, ttFont, progress=None, compactGlyphs=0):
def toXML(self, writer, ttFont, progress=None):
writer.newline()
glyphOrder = ttFont.getGlyphOrder()
writer.begintag("GlyphOrder")
@ -90,8 +91,6 @@ class table__g_l_y_f(DefaultTable.DefaultTable):
])
writer.newline()
glyph.toXML(writer, ttFont)
if compactGlyphs:
glyph.compact(self)
writer.endtag('TTGlyph')
writer.newline()
else:
@ -207,8 +206,8 @@ class Glyph:
return
self.data = data
def compact(self, glyfTable):
data = self.compile(glyfTable)
def compact(self, glyfTable, recalcBBoxes=1):
data = self.compile(glyfTable, recalcBBoxes)
self.__dict__.clear()
self.data = data
@ -223,11 +222,12 @@ class Glyph:
else:
self.decompileCoordinates(data)
def compile(self, glyfTable):
def compile(self, glyfTable, recalcBBoxes=1):
if hasattr(self, "data"):
return self.data
if self.numberOfContours == 0:
return ""
if recalcBBoxes:
self.recalcBounds(glyfTable)
data = sstruct.pack(glyphHeaderFormat, self)
if self.numberOfContours == -1: