def contains_bad_glyph(glyph_data, data):
def check_glyph(char):<EOL><INDENT>for cmap in glyph_data["<STR_LIT>"].tables:<EOL><INDENT>if cmap.isUnicode():<EOL><INDENT>if char in cmap.cmap:<EOL><INDENT>return True<EOL><DEDENT><DEDENT><DEDENT>return False<EOL><DEDENT>for part in data:<EOL><INDENT>text = part.get("<STR_LIT>", "<STR_LIT>")<EOL>try:<EOL><INDENT>text = text.decode("<STR_LIT:utf8>")<EOL><DEDENT>except AttributeError:<EOL><INDENT>pass<EOL><DEDENT>for char in text:<EOL><INDENT>if not check_glyph(ord(char)):<EOL><INDENT>print(u"<STR_LIT>" % (char, ord(char)))<EOL>return True<EOL><DEDENT><DEDENT><DEDENT>return False<EOL>
Pillow only looks for glyphs in the font used so we need to make sure our
font has the glygh.  Although we could substitute a glyph from another font
eg symbola but this adds more complexity and is of limited value.