Just | 7842e56 | 1999-12-16 21:34:53 +0000 | [diff] [blame^] | 1 | import string |
| 2 | import sys |
| 3 | |
| 4 | class DefaultTable: |
| 5 | |
| 6 | dependencies = [] |
| 7 | |
| 8 | def __init__(self, tag): |
| 9 | self.tableTag = tag |
| 10 | |
| 11 | def decompile(self, data, ttFont): |
| 12 | self.data = data |
| 13 | |
| 14 | def compile(self, ttFont): |
| 15 | return self.data |
| 16 | |
| 17 | def toXML(self, writer, ttFont): |
| 18 | writer.begintag("hexdata") |
| 19 | writer.newline() |
| 20 | writer.dumphex(self.compile(ttFont)) |
| 21 | writer.endtag("hexdata") |
| 22 | writer.newline() |
| 23 | |
| 24 | def fromXML(self, (name, attrs, content), ttFont): |
| 25 | from fontTools.misc.textTools import readHex |
| 26 | from fontTools import ttLib |
| 27 | if name <> "hexdata": |
| 28 | raise ttLib.TTLibError, "can't handle '%s' element" % name |
| 29 | self.decompile(readHex(content), ttFont) |
| 30 | |
| 31 | def __repr__(self): |
| 32 | return "<'%s' table at %x>" % (self.tableTag, id(self)) |
| 33 | |
| 34 | def __cmp__(self, other): |
| 35 | return cmp(self.__dict__, other.__dict__) |
| 36 | |