निम्नलिखित पायथन स्क्रिप्ट में एक वर्ण (मेरे लिनक्स बॉक्स पर परीक्षण) वाले सभी फोंट प्रिंट होंगे।
import unicodedata
import os
fonts = []
for root,dirs,files in os.walk("/usr/share/fonts/"):
for file in files:
if file.endswith(".ttf"): fonts.append(os.path.join(root,file))
from fontTools.ttLib import TTFont
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
def test(char):
for fontpath in fonts:
font = TTFont(fontpath) # specify the path to the font in question
if char_in_font(char, font):
print(char + " "+ unicodedata.name(char) + " in " + fontpath)
test(u"😺")
test(u"🐈")
मेरी मशीन पर, यह देता है:
😺 SMILING CAT FACE WITH OPEN MOUTH in /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansCondensed.ttf
😺 SMILING CAT FACE WITH OPEN MOUTH in /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf
😺 SMILING CAT FACE WITH OPEN MOUTH in /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf
😺 SMILING CAT FACE WITH OPEN MOUTH in /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansCondensed-Bold.ttf
😺 SMILING CAT FACE WITH OPEN MOUTH in /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Oblique.ttf
😺 SMILING CAT FACE WITH OPEN MOUTH in /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansCondensed-Oblique.ttf
😺 SMILING CAT FACE WITH OPEN MOUTH in /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansCondensed-BoldOblique.ttf
😺 SMILING CAT FACE WITH OPEN MOUTH in /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-BoldOblique.ttf
😺 SMILING CAT FACE WITH OPEN MOUTH in /usr/share/fonts/truetype/dejavu/DejaVuSansCondensed.ttf
😺 SMILING CAT FACE WITH OPEN MOUTH in /usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf
😺 SMILING CAT FACE WITH OPEN MOUTH in /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf
😺 SMILING CAT FACE WITH OPEN MOUTH in /usr/share/fonts/truetype/dejavu/DejaVuSansCondensed-Bold.ttf
😺 SMILING CAT FACE WITH OPEN MOUTH in /usr/share/fonts/truetype/dejavu/DejaVuSans-Oblique.ttf
😺 SMILING CAT FACE WITH OPEN MOUTH in /usr/share/fonts/truetype/dejavu/DejaVuSansCondensed-Oblique.ttf
😺 SMILING CAT FACE WITH OPEN MOUTH in /usr/share/fonts/truetype/dejavu/DejaVuSansCondensed-BoldOblique.ttf
😺 SMILING CAT FACE WITH OPEN MOUTH in /usr/share/fonts/truetype/dejavu/DejaVuSans-BoldOblique.ttf
🐈 CAT in /usr/share/fonts/truetype/noto/NotoSansSymbols2-Regular.ttf