[_g_l_y_f] factor out code for writing instructions in toXML
This commit is contained in:
parent
0aa086a94b
commit
0918f7cf3e
@ -354,12 +354,7 @@ class Glyph(object):
|
||||
if self.isComposite():
|
||||
for compo in self.components:
|
||||
compo.toXML(writer, ttFont)
|
||||
if hasattr(self, "program"):
|
||||
writer.begintag("instructions")
|
||||
writer.newline()
|
||||
self.program.toXML(writer, ttFont)
|
||||
writer.endtag("instructions")
|
||||
writer.newline()
|
||||
haveInstructions = hasattr(self, "program")
|
||||
else:
|
||||
last = 0
|
||||
for i in range(self.numberOfContours):
|
||||
@ -374,12 +369,13 @@ class Glyph(object):
|
||||
last = self.endPtsOfContours[i] + 1
|
||||
writer.endtag("contour")
|
||||
writer.newline()
|
||||
if self.numberOfContours:
|
||||
writer.begintag("instructions")
|
||||
writer.newline()
|
||||
self.program.toXML(writer, ttFont)
|
||||
writer.endtag("instructions")
|
||||
writer.newline()
|
||||
haveInstructions = self.numberOfContours > 0
|
||||
if haveInstructions:
|
||||
writer.begintag("instructions")
|
||||
writer.newline()
|
||||
self.program.toXML(writer, ttFont)
|
||||
writer.endtag("instructions")
|
||||
writer.newline()
|
||||
|
||||
def fromXML(self, name, attrs, content, ttFont):
|
||||
if name == "contour":
|
||||
|
Loading…
x
Reference in New Issue
Block a user