Created
July 17, 2015 06:27
-
-
Save arthuredelstein/a88186a338993be148c0 to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env python | |
# Expects paths to two files: Prints the code points in the first file but not in the second, | |
# and vice versa. | |
# Based on https://stackoverflow.com/questions/4458696/finding-out-what-characters-a-font-supports | |
from itertools import chain | |
import sys | |
from fontTools.ttLib import TTFont | |
from fontTools.unicode import Unicode | |
def ttfCodePoints(filename): | |
ttf = TTFont(filename, 0, verbose=0, allowVID=0, | |
ignoreDecompileErrors=True, | |
fontNumber=-1) | |
points = set(chain.from_iterable([y[0] for y in x.cmap.items()] for x in ttf["cmap"].tables)) | |
ttf.close() | |
return points | |
ttfCodePoints1 = ttfCodePoints(sys.argv[1]) | |
ttfCodePoints2 = ttfCodePoints(sys.argv[2]) | |
print "Unicode points in {} but not in {}:".format(sys.argv[1], sys.argv[2]) | |
print(ttfCodePoints1.difference(ttfCodePoints2)) | |
print "Unicode points in {} but not in {}:".format(sys.argv[2], sys.argv[1]) | |
print(ttfCodePoints2.difference(ttfCodePoints1)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I wanted to ask the question: Is DroidSansFallbackFull.ttf a superset of DroidSansFallback.ttf? Here are my results:
Answer: Yes.