def add_to_cmap(font, mapping):
    cmap_table = font['cmap']
    for table in cmap_table.tables:
        if (table.format, table.platformID, table.platEncID) in UNICODE_CMAPS:
            for code, glyph in mapping.iteritems():
                table.cmap[code] = glyph
Adds a codepoint to glyph mapping to a font's cmap.
dataset/ETHPy150Open googlei18n/nototools/nototools/font_data.py/add_to_cmap