Created
October 3, 2015 09:32
-
-
Save weiweihuanghuang/a11c169be85a0e9824de to your computer and use it in GitHub Desktop.
Compare UFOs
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
from robofab.interface.all.dialogs import SelectFont | |
from robofab.pens.digestPen import DigestPointPen | |
# f1 = SelectFont("Select 'Master' font:") | |
# f2 = SelectFont("Select font to compare:") | |
fonts = AllFonts() | |
f1 = fonts[0] | |
f2 = fonts[1] | |
f1_glyphset = set(f1.keys()) | |
f2_glyphset = set(f2.keys()) | |
commonGlyphs = list(f1_glyphset.intersection(f2_glyphset)) | |
notSameGlyphs = [] | |
for g in commonGlyphs: | |
g1 = f1[g] | |
g2 = f2[g] | |
p1 = DigestPointPen() | |
g1.drawPoints(p1) | |
d1 = p1.getDigest() | |
p2 = DigestPointPen() | |
g2.drawPoints(p2) | |
d2 = p2.getDigest() | |
if d1 != d2: | |
notSameGlyphs += [g] | |
print notSameGlyphs | |
print '/{0}'.format('/'.join(notSameGlyphs)) | |
print '{0}'.format(' '.join(notSameGlyphs)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment