blob: 47b37d0fa2a3db1f9626619365ad954e3e9359ea [file] [log] [blame]
Behdad Esfahbod32c10ee2013-11-27 17:46:17 -05001from __future__ import print_function, division
Behdad Esfahbod7ed91ec2013-11-27 15:16:28 -05002from fontTools.misc.py23 import *
Behdad Esfahbod30e691e2013-11-27 17:27:45 -05003from . import DefaultTable
Just7cb62722000-01-04 14:03:13 +00004
5
6class asciiTable(DefaultTable.DefaultTable):
7
8 def toXML(self, writer, ttFont):
Just599cc2f2000-01-05 20:45:38 +00009 data = self.data
10 # removing null bytes. XXX needed??
Behdad Esfahbod14fb0312013-11-27 05:47:34 -050011 data = data.split('\0')
12 data = ''.join(data)
Just7cb62722000-01-04 14:03:13 +000013 writer.begintag("source")
14 writer.newline()
Behdad Esfahbod14fb0312013-11-27 05:47:34 -050015 writer.write_noindent(data.replace("\r", "\n"))
Just7cb62722000-01-04 14:03:13 +000016 writer.newline()
17 writer.endtag("source")
18 writer.newline()
19
Behdad Esfahbod3a9fd302013-11-27 03:19:32 -050020 def fromXML(self, name, attrs, content, ttFont):
Behdad Esfahbod14fb0312013-11-27 05:47:34 -050021 lines = ''.join(content).replace("\r", "\n").split("\n")
22 self.data = "\r".join(lines[1:-1])
Just7cb62722000-01-04 14:03:13 +000023