def decompile(self, data, ttFont):
    (tableVersion, numSubTables) = struct.unpack('>HH', data[:4])
    self.tableVersion = int(tableVersion)
    self.tables = tables = []
    seenOffsets = {}
    for i in range(numSubTables):
        (platformID, platEncID, offset) = struct.unpack('>HHl', data[(4 + (i * 8)):(4 + ((i + 1) * 8))])
        (platformID, platEncID) = (int(platformID), int(platEncID))
        (format, length) = struct.unpack('>HH', data[offset:(offset + 4)])
        if (format in [8, 10, 12, 13]):
            (format, reserved, length) = struct.unpack('>HHL', data[offset:(offset + 8)])
        elif (format in [14]):
            (format, length) = struct.unpack('>HL', data[offset:(offset + 6)])
        if (not length):
            print(('Error: cmap subtable is reported as having zero length: platformID %s, platEncID %s,  format %s offset %s. Skipping table.' % (platformID, platEncID, format, offset)))
            continue
        table = CmapSubtable.newSubtable(format)
        table.platformID = platformID
        table.platEncID = platEncID
        table.decompileHeader(data[offset:(offset + int(length))], ttFont)
        if (offset in seenOffsets):
            table.cmap = tables[seenOffsets[offset]].cmap
        else:
            seenOffsets[offset] = i
        tables.append(table)
def decompile(self, data, ttFont):
    (tableVersion, numSubTables) = struct.unpack('>HH', data[:4])
    self.tableVersion = int(tableVersion)
    self.tables = tables = []
    seenOffsets = {}
    for i in range(numSubTables):
        (platformID, platEncID, offset) = struct.unpack('>HHl', data[(4 + (i * 8)):(4 + ((i + 1) * 8))])
        (platformID, platEncID) = (int(platformID), int(platEncID))
        (format, length) = struct.unpack('>HH', data[offset:(offset + 4)])
        if (format in [8, 10, 12, 13]):
            (format, reserved, length) = struct.unpack('>HHL', data[offset:(offset + 8)])
        elif (format in [14]):
            (format, length) = struct.unpack('>HL', data[offset:(offset + 6)])
        if (not length):
            print(('Error: cmap subtable is reported as having zero length: platformID %s, platEncID %s,  format %s offset %s. Skipping table.' % (platformID, platEncID, format, offset)))
            continue
        table = CmapSubtable.newSubtable(format)
        table.platformID = platformID
        table.platEncID = platEncID
        table.decompileHeader(data[offset:(offset + int(length))], ttFont)
        if (offset in seenOffsets):
            table.cmap = tables[seenOffsets[offset]].cmap
        else:
            seenOffsets[offset] = i
        tables.append(table)