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