2013-11-27 17:46:17 -05:00
|
|
|
from __future__ import print_function, division
|
2013-11-27 15:16:28 -05:00
|
|
|
from fontTools.misc.py23 import *
|
1999-12-16 21:34:53 +00:00
|
|
|
|
|
|
|
class DefaultTable:
|
|
|
|
|
|
|
|
dependencies = []
|
|
|
|
|
|
|
|
def __init__(self, tag):
|
2013-11-27 18:16:43 -05:00
|
|
|
self.tableTag = Tag(tag)
|
1999-12-16 21:34:53 +00:00
|
|
|
|
|
|
|
def decompile(self, data, ttFont):
|
|
|
|
self.data = data
|
|
|
|
|
|
|
|
def compile(self, ttFont):
|
|
|
|
return self.data
|
|
|
|
|
|
|
|
def toXML(self, writer, ttFont):
|
2000-01-03 23:00:10 +00:00
|
|
|
if hasattr(self, "ERROR"):
|
|
|
|
writer.comment("An error occurred during the decompilation of this table")
|
|
|
|
writer.newline()
|
|
|
|
writer.comment(self.ERROR)
|
|
|
|
writer.newline()
|
1999-12-16 21:34:53 +00:00
|
|
|
writer.begintag("hexdata")
|
|
|
|
writer.newline()
|
|
|
|
writer.dumphex(self.compile(ttFont))
|
|
|
|
writer.endtag("hexdata")
|
|
|
|
writer.newline()
|
|
|
|
|
2013-11-27 03:19:32 -05:00
|
|
|
def fromXML(self, name, attrs, content, ttFont):
|
1999-12-16 21:34:53 +00:00
|
|
|
from fontTools.misc.textTools import readHex
|
|
|
|
from fontTools import ttLib
|
2013-11-27 02:40:30 -05:00
|
|
|
if name != "hexdata":
|
2013-11-27 02:42:28 -05:00
|
|
|
raise ttLib.TTLibError("can't handle '%s' element" % name)
|
1999-12-16 21:34:53 +00:00
|
|
|
self.decompile(readHex(content), ttFont)
|
|
|
|
|
|
|
|
def __repr__(self):
|
|
|
|
return "<'%s' table at %x>" % (self.tableTag, id(self))
|
|
|
|
|
2013-11-27 18:58:45 -05:00
|
|
|
def __eq__(self, other):
|
|
|
|
if type(self) != type(other):
|
|
|
|
raise TypeError("unordered types %s() < %s()", type(self), type(other))
|
|
|
|
return self.__dict__ == other.__dict__
|