参见https://unix.stackexchange.com/questions/247108/how-to-find-out-which- unicode-codepoints-are-defined-in-a- ttf文件
简而言之,可以安装fonttools软件包,为它提供任何感兴趣的.ttf字体文件的路径,并检查字体文件的unicode映射表中是否包含感兴趣的unicode字符的长格式。
from fontTools.ttLib import TTFont
font = TTFont(fontpath) # specify the path to the font in question
def char_in_font(unicode_char, font):
for cmap in font['cmap'].tables:
if cmap.isUnicode():
if ord(unicode_char) in cmap.cmap:
return True
return False