'Get a mapping of character codes to glyph ids in the font.'

def get_character_map(self, chars):

    if (self.bmp_table is None):
        raise UnsupportedFont(u'This    font    has    no    Windows    BMP    cmap    subtable.    Most    likely    a    special    purpose    font.')
    chars = list(set(chars))
    chars.sort()
    ans = OrderedDict()
    for (i, glyph_id) in enumerate(self.bmp_table.get_glyph_ids(chars)):
        if (glyph_id > 0):
            ans[chars[i]] = glyph_id
    return ans
