• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1from fontTools.misc.py23 import strjoin, tobytes, tostr
2from . import DefaultTable
3
4
5class asciiTable(DefaultTable.DefaultTable):
6
7	def toXML(self, writer, ttFont):
8		data = tostr(self.data)
9		# removing null bytes. XXX needed??
10		data = data.split('\0')
11		data = strjoin(data)
12		writer.begintag("source")
13		writer.newline()
14		writer.write_noindent(data)
15		writer.newline()
16		writer.endtag("source")
17		writer.newline()
18
19	def fromXML(self, name, attrs, content, ttFont):
20		lines = strjoin(content).split("\n")
21		self.data = tobytes("\n".join(lines[1:-1]))
22