[_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():
|
if self.isComposite():
|
||||||
for compo in self.components:
|
for compo in self.components:
|
||||||
compo.toXML(writer, ttFont)
|
compo.toXML(writer, ttFont)
|
||||||
if hasattr(self, "program"):
|
haveInstructions = hasattr(self, "program")
|
||||||
writer.begintag("instructions")
|
|
||||||
writer.newline()
|
|
||||||
self.program.toXML(writer, ttFont)
|
|
||||||
writer.endtag("instructions")
|
|
||||||
writer.newline()
|
|
||||||
else:
|
else:
|
||||||
last = 0
|
last = 0
|
||||||
for i in range(self.numberOfContours):
|
for i in range(self.numberOfContours):
|
||||||
@ -374,12 +369,13 @@ class Glyph(object):
|
|||||||
last = self.endPtsOfContours[i] + 1
|
last = self.endPtsOfContours[i] + 1
|
||||||
writer.endtag("contour")
|
writer.endtag("contour")
|
||||||
writer.newline()
|
writer.newline()
|
||||||
if self.numberOfContours:
|
haveInstructions = self.numberOfContours > 0
|
||||||
writer.begintag("instructions")
|
if haveInstructions:
|
||||||
writer.newline()
|
writer.begintag("instructions")
|
||||||
self.program.toXML(writer, ttFont)
|
writer.newline()
|
||||||
writer.endtag("instructions")
|
self.program.toXML(writer, ttFont)
|
||||||
writer.newline()
|
writer.endtag("instructions")
|
||||||
|
writer.newline()
|
||||||
|
|
||||||
def fromXML(self, name, attrs, content, ttFont):
|
def fromXML(self, name, attrs, content, ttFont):
|
||||||
if name == "contour":
|
if name == "contour":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user