1999-12-16 21:34:53 +00:00
|
|
|
import string
|
|
|
|
import sys
|
|
|
|
|
|
|
|
class DefaultTable:
|
|
|
|
|
|
|
|
dependencies = []
|
|
|
|
|
|
|
|
def __init__(self, tag):
|
|
|
|
self.tableTag = tag
|
|
|
|
|
|
|
|
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()
|
|
|
|
|
|
|
|
def fromXML(self, (name, attrs, content), ttFont):
|
|
|
|
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))
|
|
|
|
|
|
|
|
def __cmp__(self, other):
|
2013-10-28 12:07:15 +01:00
|
|
|
if type(self) != type(other): return cmp(type(self), type(other))
|
|
|
|
if self.__class__ != other.__class__: return cmp(self.__class__, other.__class__)
|
2013-08-17 11:11:22 -04:00
|
|
|
|
1999-12-16 21:34:53 +00:00
|
|
|
return cmp(self.__dict__, other.__dict__)
|
|
|
|
|