def character_set(font):
    """Returns the character coverage of a font.

    Args:
      font: The input font's file name, or a TTFont.

    Returns:
      A frozenset listing the characters supported in the font.
    """
    if type(font) is str:
        font = ttLib.TTFont(font)
    cmap_table = font["cmap"]


    cmaps = {}
    for table in cmap_table.tables:
        if (table.format, table.platformID, table.platEncID) in [
            (4, 3, 1), (12, 3, 10)]:
            cmaps[table.format] = table.cmap
    if 12 in cmaps:
        cmap = cmaps[12]
    elif 4 in cmaps:
        cmap = cmaps[4]
    else:
        cmap = {}
    # names = {}        
    # for code, name in cmap.items():
        # names[name] = code
        # print "names[%s] = %s" % (name, code)
    f = open('/Users/brucelee/Documents/workspace/doing_custom_fonts/input/NotoSansCJKsc_SimplifiedChinese/cmap','wb')
    # f.write(json.dumps(sorted(frozenset(cmap.keys())))) # python will convert \n to os.linesep
    f.write(json.dumps(cmap)) # python will convert \n to os.linesep
    f.close() # you can omi

    return frozenset(cmap.keys())
dataset/ETHPy150Open dieface/domywebfont/coverage.py/character_set/original