MCPcopy Create free account
hub / github.com/coldtype/st2 / toXML

Method toXML

ST2/meshtable.py:89–114  ·  view source on GitHub ↗
(self, xmlWriter, ttFont)

Source from the content-addressed store, hash-verified

87 self.rawdata = sstruct.pack(meshGlyphHeaderFormat, self) + self.meshData
88
89 def toXML(self, xmlWriter, ttFont):
90 if self.graphicType == None:
91 # TODO: ignore empty glyphs?
92 # a glyph data entry is required for each glyph,
93 # but empty ones can be calculated at compile time
94 xmlWriter.simpletag("glyph", name=self.glyphName)
95 xmlWriter.newline()
96 return
97 xmlWriter.begintag("glyph",
98 graphicType=self.graphicType,
99 name=self.glyphName,
100 originOffsetX=self.originOffsetX,
101 originOffsetY=self.originOffsetY,
102 )
103 xmlWriter.newline()
104 if self.graphicType == "dupe":
105 # graphicType == "dupe" is a reference to another glyph id.
106 xmlWriter.simpletag("ref", glyphname=self.referenceGlyphName)
107 else:
108 xmlWriter.begintag("hexdata")
109 xmlWriter.newline()
110 xmlWriter.dumphex(self.meshData)
111 xmlWriter.endtag("hexdata")
112 xmlWriter.newline()
113 xmlWriter.endtag("glyph")
114 xmlWriter.newline()
115
116 def fromXML(self, name, attrs, content, ttFont):
117 if name == "ref":

Callers 2

toXMLMethod · 0.45
toXMLMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected