blob: e3a38e107f40f1662572c9a4f16b6a1c81a7ee6a [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
Behdad Esfahbod3a9fd302013-11-27 03:19:32 -050019 def fromXML(self, name, attrs, content, ttFont):
Just7cb62722000-01-04 14:03:13 +000020 lines = string.split(string.replace(string.join(content, ""), "\r", "\n"), "\n")
21 self.data = string.join(lines[1:-1], "\r")
22