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
単一のコードポイントの絵文字しか含まれていないため、複数のコードポイントの絵文字に対してこれを行うにはどうすればよいですか?