Created
September 15, 2016 08:56
-
-
Save amake/97b9ecff3fbaaa1dd855e6de80ce4f92 to your computer and use it in GitHub Desktop.
Dump Android supported glyphs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Call this with TrueType font filename arguments to output a list of | |
all Unicode characters covered by all fonts, e.g. | |
list_ttf_chars.py $ANDROID_HOME/platforms/android-XY/data/fonts/*.ttf | |
Requires FontTools: https://pypi.python.org/pypi/FontTools | |
''' | |
import sys | |
from fontTools.ttLib import TTFont | |
from fontTools.unicode import Unicode | |
chars = {} | |
for f in sys.argv[1:]: | |
for table in TTFont(f)['cmap'].tables: | |
chars.update(table.cmap) | |
print('\n'.join(['U+%06x %s' % (c, desc) | |
for c, desc in sorted(chars.items())])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment