blob: 623f53d1179bf209f7a2cf675a224e94012ed3ad [file] [log] [blame]
Just7cb62722000-01-04 14:03:13 +00001import string
Behdad Esfahbod2b06aaa2013-11-27 02:34:11 -05002from . import DefaultTable
Just7cb62722000-01-04 14:03:13 +00003
4
5class asciiTable(DefaultTable.DefaultTable):
6
7 def toXML(self, writer, ttFont):
Just599cc2f2000-01-05 20:45:38 +00008 data = self.data
9 # removing null bytes. XXX needed??
10 data = string.split(data, '\0')
11 data = string.join(data, '')
Just7cb62722000-01-04 14:03:13 +000012 writer.begintag("source")
13 writer.newline()
Just599cc2f2000-01-05 20:45:38 +000014 writer.write_noindent(string.replace(data, "\r", "\n"))
Just7cb62722000-01-04 14:03:13 +000015 writer.newline()
16 writer.endtag("source")
17 writer.newline()
18
19 def fromXML(self, (name, attrs, content), ttFont):
20 lines = string.split(string.replace(string.join(content, ""), "\r", "\n"), "\n")
21 self.data = string.join(lines[1:-1], "\r")
22