Exemplo n.º 1
0
def write_data(td):
    """Writes CharStrings from the TopDict td into a string that is easily
    readable."""

    out = BytesIO()
    td.CharStrings.charStringsIndex.getCompiler(td.strings, None).toFile(out)
    return out.getvalue()
Exemplo n.º 2
0
def write_data(td):
    """Writes CharStrings from the TopDict td into a string that is easily
    readable."""

    out = BytesIO()
    td.CharStrings.charStringsIndex.getCompiler(td.strings, None).toFile(out)
    return out.getvalue()
Exemplo n.º 3
0
def write_data(td):
    """Writes CharStrings and FDSelect from the TopDict td into a string
    that is easily readable."""

    out = BytesIO()
    td.CharStrings.charStringsIndex.getCompiler(td.strings, None).toFile(out)
    try:
        fdselect = struct.pack('B', len(td.FDArray)) + array.array('B', list(td.FDSelect)).tostring()
    except AttributeError:
        fdselect = struct.pack('B', 1)
    out.write(fdselect)
    return out.getvalue()