【发布时间】:2019-08-17 18:40:33
【问题描述】:
我正在尝试检查字体是否具有多代码点表情符号的字形,例如“????????♂️”、“????????”要么 ”????????”在 Python 3.x 中。
对于像“????”这样的单个代码点表情符号要么 ”????”我可以使用 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
由于cmp 中只有单个代码点表情符号,我该如何为多代码点表情符号执行此操作?
【问题讨论】:
标签: python-3.x emoji python-unicode codepoint