Merge pull request #3 from anthrotype/xml-instructions

don't write newline at end of fpgm/prep and revert test data changes
This commit is contained in:
Jens Kutilek 2017-01-25 10:11:26 +01:00 committed by GitHub
commit 8a5b4dc65f
4 changed files with 27 additions and 49 deletions

View File

@ -15,7 +15,6 @@ class table__f_p_g_m(DefaultTable.DefaultTable):
def toXML(self, writer, ttFont): def toXML(self, writer, ttFont):
self.program.toXML(writer, ttFont) self.program.toXML(writer, ttFont)
writer.newline()
def fromXML(self, name, attrs, content, ttFont): def fromXML(self, name, attrs, content, ttFont):
program = ttProgram.Program() program = ttProgram.Program()

View File

@ -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,16 @@ 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
if haveInstructions:
if self.program:
writer.begintag("instructions") writer.begintag("instructions")
writer.newline() writer.newline()
self.program.toXML(writer, ttFont) self.program.toXML(writer, ttFont)
writer.endtag("instructions") writer.endtag("instructions")
writer.newline() else:
writer.simpletag("instructions")
writer.newline()
def fromXML(self, name, attrs, content, ttFont): def fromXML(self, name, attrs, content, ttFont):
if name == "contour": if name == "contour":

View File

@ -442,8 +442,7 @@
<pt x="265" y="633" on="1"/> <pt x="265" y="633" on="1"/>
<pt x="66" y="633" on="1"/> <pt x="66" y="633" on="1"/>
</contour> </contour>
<instructions> <instructions><assembly>
<assembly>
PUSH[ ] /* 2 values pushed */ PUSH[ ] /* 2 values pushed */
1 0 1 0
MDAP[1] /* MoveDirectAbsPt */ MDAP[1] /* MoveDirectAbsPt */
@ -477,8 +476,7 @@
1 2 0 1 2 0
MIRP[01101] /* MoveIndirectRelPt */ MIRP[01101] /* MoveIndirectRelPt */
SHP[0] /* ShiftPointByLastPoint */ SHP[0] /* ShiftPointByLastPoint */
</assembly> </assembly></instructions>
</instructions>
</TTGlyph> </TTGlyph>
<TTGlyph name=".null"/><!-- contains no outline data --> <TTGlyph name=".null"/><!-- contains no outline data -->
@ -490,10 +488,8 @@
<pt x="305" y="0" on="1"/> <pt x="305" y="0" on="1"/>
<pt x="100" y="0" on="1"/> <pt x="100" y="0" on="1"/>
</contour> </contour>
<instructions> <instructions><assembly>
<assembly> </assembly></instructions>
</assembly>
</instructions>
</TTGlyph> </TTGlyph>
<TTGlyph name="b" xMin="100" yMin="0" xMax="305" yMax="205"> <TTGlyph name="b" xMin="100" yMin="0" xMax="305" yMax="205">
@ -503,10 +499,8 @@
<pt x="305" y="0" on="1"/> <pt x="305" y="0" on="1"/>
<pt x="100" y="0" on="1"/> <pt x="100" y="0" on="1"/>
</contour> </contour>
<instructions> <instructions><assembly>
<assembly> </assembly></instructions>
</assembly>
</instructions>
</TTGlyph> </TTGlyph>
<TTGlyph name="c" xMin="100" yMin="0" xMax="305" yMax="205"> <TTGlyph name="c" xMin="100" yMin="0" xMax="305" yMax="205">
@ -516,10 +510,8 @@
<pt x="305" y="0" on="1"/> <pt x="305" y="0" on="1"/>
<pt x="100" y="0" on="1"/> <pt x="100" y="0" on="1"/>
</contour> </contour>
<instructions> <instructions><assembly>
<assembly> </assembly></instructions>
</assembly>
</instructions>
</TTGlyph> </TTGlyph>
<TTGlyph name="nonmarkingreturn"/><!-- contains no outline data --> <TTGlyph name="nonmarkingreturn"/><!-- contains no outline data -->
@ -585,10 +577,8 @@
<pt x="354" y="430" on="0"/> <pt x="354" y="430" on="0"/>
<pt x="320" y="430" on="0"/> <pt x="320" y="430" on="0"/>
</contour> </contour>
<instructions> <instructions><assembly>
<assembly> </assembly></instructions>
</assembly>
</instructions>
</TTGlyph> </TTGlyph>
<TTGlyph name="smileface.84380d" xMin="238" yMin="181" xMax="761" yMax="606"> <TTGlyph name="smileface.84380d" xMin="238" yMin="181" xMax="761" yMax="606">
@ -632,10 +622,8 @@
<pt x="354" y="430" on="0"/> <pt x="354" y="430" on="0"/>
<pt x="320" y="430" on="0"/> <pt x="320" y="430" on="0"/>
</contour> </contour>
<instructions> <instructions><assembly>
<assembly> </assembly></instructions>
</assembly>
</instructions>
</TTGlyph> </TTGlyph>
<TTGlyph name="smileface.e59b25" xMin="100" yMin="0" xMax="900" yMax="800"> <TTGlyph name="smileface.e59b25" xMin="100" yMin="0" xMax="900" yMax="800">
@ -659,10 +647,8 @@
<pt x="653" y="770" on="0"/> <pt x="653" y="770" on="0"/>
<pt x="347" y="770" on="0"/> <pt x="347" y="770" on="0"/>
</contour> </contour>
<instructions> <instructions><assembly>
<assembly> </assembly></instructions>
</assembly>
</instructions>
</TTGlyph> </TTGlyph>
<TTGlyph name="smileface.ffe08a" xMin="100" yMin="0" xMax="900" yMax="800"> <TTGlyph name="smileface.ffe08a" xMin="100" yMin="0" xMax="900" yMax="800">
@ -676,10 +662,8 @@
<pt x="666" y="0" on="0"/> <pt x="666" y="0" on="0"/>
<pt x="334" y="0" on="0"/> <pt x="334" y="0" on="0"/>
</contour> </contour>
<instructions> <instructions><assembly>
<assembly> </assembly></instructions>
</assembly>
</instructions>
</TTGlyph> </TTGlyph>
</glyf> </glyf>

View File

@ -36,8 +36,7 @@
<pt x="666" y="0" on="0"/> <pt x="666" y="0" on="0"/>
<pt x="334" y="0" on="0"/> <pt x="334" y="0" on="0"/>
</contour> </contour>
<instructions> <instructions/>
</instructions>
</TTGlyph> </TTGlyph>
<TTGlyph name="glyph00003" xMin="100" yMin="0" xMax="900" yMax="800"> <TTGlyph name="glyph00003" xMin="100" yMin="0" xMax="900" yMax="800">
@ -61,8 +60,7 @@
<pt x="653" y="770" on="0"/> <pt x="653" y="770" on="0"/>
<pt x="347" y="770" on="0"/> <pt x="347" y="770" on="0"/>
</contour> </contour>
<instructions> <instructions/>
</instructions>
</TTGlyph> </TTGlyph>
<TTGlyph name="glyph00004" xMin="238" yMin="181" xMax="761" yMax="606"> <TTGlyph name="glyph00004" xMin="238" yMin="181" xMax="761" yMax="606">
@ -106,8 +104,7 @@
<pt x="354" y="430" on="0"/> <pt x="354" y="430" on="0"/>
<pt x="320" y="430" on="0"/> <pt x="320" y="430" on="0"/>
</contour> </contour>
<instructions> <instructions/>
</instructions>
</TTGlyph> </TTGlyph>
<TTGlyph name="smileface" xMin="100" yMin="0" xMax="900" yMax="800"> <TTGlyph name="smileface" xMin="100" yMin="0" xMax="900" yMax="800">
@ -171,8 +168,7 @@
<pt x="354" y="430" on="0"/> <pt x="354" y="430" on="0"/>
<pt x="320" y="430" on="0"/> <pt x="320" y="430" on="0"/>
</contour> </contour>
<instructions> <instructions/>
</instructions>
</TTGlyph> </TTGlyph>
</glyf> </glyf>