def decompile(self, data, ttFont):
    if ((data is not None) and (ttFont is not None)):
        self.decompileHeader(data, ttFont)
    else:
        assert ((data is None) and (ttFont is None)), 'Need both data and ttFont arguments'
    data = self.data
    (firstCode, entryCount) = struct.unpack('>HH', data[:4])
    firstCode = int(firstCode)
    data = data[4:]
    glyphIndexArray = array.array('H')
    glyphIndexArray.fromstring(data[:(2 * int(entryCount))])
    if (sys.byteorder != 'big'):
        glyphIndexArray.byteswap()
    self.data = data = None
    self.cmap = cmap = {}
    lenArray = len(glyphIndexArray)
    charCodes = list(range(firstCode, (firstCode + lenArray)))
    glyphOrder = self.ttFont.getGlyphOrder()
    try:
        names = list(map(operator.getitem, ([glyphOrder] * lenArray), glyphIndexArray))
    except IndexError:
        getGlyphName = self.ttFont.getGlyphName
        names = list(map(getGlyphName, glyphIndexArray))
    list(map(operator.setitem, ([cmap] * lenArray), charCodes, names))
def decompile(self, data, ttFont):
    if ((data is not None) and (ttFont is not None)):
        self.decompileHeader(data, ttFont)
    else:
        assert ((data is None) and (ttFont is None)), 'Need both data and ttFont arguments'
    data = self.data
    (firstCode, entryCount) = struct.unpack('>HH', data[:4])
    firstCode = int(firstCode)
    data = data[4:]
    glyphIndexArray = array.array('H')
    glyphIndexArray.fromstring(data[:(2 * int(entryCount))])
    if (sys.byteorder != 'big'):
        glyphIndexArray.byteswap()
    self.data = data = None
    self.cmap = cmap = {}
    lenArray = len(glyphIndexArray)
    charCodes = list(range(firstCode, (firstCode + lenArray)))
    glyphOrder = self.ttFont.getGlyphOrder()
    try:
        names = list(map(operator.getitem, ([glyphOrder] * lenArray), glyphIndexArray))
    except IndexError:
        getGlyphName = self.ttFont.getGlyphName
        names = list(map(getGlyphName, glyphIndexArray))
    list(map(operator.setitem, ([cmap] * lenArray), charCodes, names))