Behdad Esfahbod | 2b06aaa | 2013-11-27 02:34:11 -0500 | [diff] [blame] | 1 | from . import DefaultTable |
Just | 7cb6272 | 2000-01-04 14:03:13 +0000 | [diff] [blame] | 2 | |
| 3 | |
| 4 | class asciiTable(DefaultTable.DefaultTable): |
| 5 | |
| 6 | def toXML(self, writer, ttFont): |
Just | 599cc2f | 2000-01-05 20:45:38 +0000 | [diff] [blame] | 7 | data = self.data |
| 8 | # removing null bytes. XXX needed?? |
Behdad Esfahbod | 14fb031 | 2013-11-27 05:47:34 -0500 | [diff] [blame^] | 9 | data = data.split('\0') |
| 10 | data = ''.join(data) |
Just | 7cb6272 | 2000-01-04 14:03:13 +0000 | [diff] [blame] | 11 | writer.begintag("source") |
| 12 | writer.newline() |
Behdad Esfahbod | 14fb031 | 2013-11-27 05:47:34 -0500 | [diff] [blame^] | 13 | writer.write_noindent(data.replace("\r", "\n")) |
Just | 7cb6272 | 2000-01-04 14:03:13 +0000 | [diff] [blame] | 14 | writer.newline() |
| 15 | writer.endtag("source") |
| 16 | writer.newline() |
| 17 | |
Behdad Esfahbod | 3a9fd30 | 2013-11-27 03:19:32 -0500 | [diff] [blame] | 18 | def fromXML(self, name, attrs, content, ttFont): |
Behdad Esfahbod | 14fb031 | 2013-11-27 05:47:34 -0500 | [diff] [blame^] | 19 | lines = ''.join(content).replace("\r", "\n").split("\n") |
| 20 | self.data = "\r".join(lines[1:-1]) |
Just | 7cb6272 | 2000-01-04 14:03:13 +0000 | [diff] [blame] | 21 | |