I'm trying to check if a font has a glyph for a multi codepoint emoji like "♂️", "" or "" in Python 3.x.
For single codepoint emoji like "" or "" I'm able to validate their support via the following code using Python fonttols
:
from fontTools.ttLib import TTFont
def __isEmojiSupportedByFont(emoji: str) -> bool:
font = TTFont(r"C:\Windows\Fonts\seguiemj.ttf")
emojiCodepoint = ord(str) # Only works for single codepoint emoji
for table in font['cmap'].tables:
for char_code, glyph_name in table.cmap.items():
if char_code == emojiCodepoint:
return True
return False
How do I do this for multi codepoint emoji, since the cmp
only has single codepoint emoji in it?