2000-01-04 14:03:13 +00:00
|
|
|
import string
|
|
|
|
import DefaultTable
|
|
|
|
|
|
|
|
|
|
|
|
class asciiTable(DefaultTable.DefaultTable):
|
|
|
|
|
|
|
|
def toXML(self, writer, ttFont):
|
2000-01-05 20:45:38 +00:00
|
|
|
data = self.data
|
|
|
|
# removing null bytes. XXX needed??
|
|
|
|
data = string.split(data, '\0')
|
|
|
|
data = string.join(data, '')
|
2000-01-04 14:03:13 +00:00
|
|
|
writer.begintag("source")
|
|
|
|
writer.newline()
|
2000-01-05 20:45:38 +00:00
|
|
|
writer.write_noindent(string.replace(data, "\r", "\n"))
|
2000-01-04 14:03:13 +00:00
|
|
|
writer.newline()
|
|
|
|
writer.endtag("source")
|
|
|
|
writer.newline()
|
|
|
|
|
|
|
|
def fromXML(self, (name, attrs, content), ttFont):
|
|
|
|
lines = string.split(string.replace(string.join(content, ""), "\r", "\n"), "\n")
|
|
|
|
self.data = string.join(lines[1:-1], "\r")
|
|
|
|
|