Cosimo Lupo 6731a906b4
[T_S_I_*] in VOLT's ascii tables, replace '\r' with '\n' when dumping XML
and viceversa, convert '\n' back to '\r' when reading from XML.

This restores the original newline handling of asciiTable, but only for VOLT's private tables.
2017-03-07 13:00:37 +00:00

22 lines
615 B
Python

from __future__ import print_function, division, absolute_import
from fontTools.misc.py23 import *
from . import asciiTable
class table_T_S_I_V_(asciiTable.asciiTable):
def toXML(self, writer, ttFont):
data = tostr(self.data)
# removing null bytes. XXX needed??
data = data.split('\0')
data = strjoin(data)
writer.begintag("source")
writer.newline()
writer.write_noindent(data.replace("\r", "\n"))
writer.newline()
writer.endtag("source")
writer.newline()
def fromXML(self, name, attrs, content, ttFont):
lines = strjoin(content).split("\n")
self.data = tobytes("\r".join(lines[1:-1]))