Just | 7cb6272 | 2000-01-04 14:03:13 +0000 | [diff] [blame] | 1 | import string |
Behdad Esfahbod | 2b06aaa | 2013-11-27 02:34:11 -0500 | [diff] [blame] | 2 | from . import DefaultTable |
Just | 7cb6272 | 2000-01-04 14:03:13 +0000 | [diff] [blame] | 3 | |
| 4 | |
| 5 | class asciiTable(DefaultTable.DefaultTable): |
| 6 | |
| 7 | def toXML(self, writer, ttFont): |
Just | 599cc2f | 2000-01-05 20:45:38 +0000 | [diff] [blame] | 8 | data = self.data |
| 9 | # removing null bytes. XXX needed?? |
| 10 | data = string.split(data, '\0') |
| 11 | data = string.join(data, '') |
Just | 7cb6272 | 2000-01-04 14:03:13 +0000 | [diff] [blame] | 12 | writer.begintag("source") |
| 13 | writer.newline() |
Just | 599cc2f | 2000-01-05 20:45:38 +0000 | [diff] [blame] | 14 | writer.write_noindent(string.replace(data, "\r", "\n")) |
Just | 7cb6272 | 2000-01-04 14:03:13 +0000 | [diff] [blame] | 15 | 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 | |