Can somebody tell me what is wrong in my Robofab steal kerning script? Why it doesn’t work on Glyphs?
Thanks in advance.
import robofab.world
from robofab.interface.all.dialogs import SelectFont
# specify lists here
left = ["quotesingle", "quotedbl", "quoteleft", "quotedblleft", "quoteright", "quotesinglbase", "quotedblbase","questiondown","questiondown.case","guillemotleft","guilsinglleft","hyphen","period","colon","comma"]
middle= ["A", "AE", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "O", "P", "Thorn", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]
right = ["quotesingle", "quotedbl", "quoteright", "quoteleft","quotedblright","quotedblleft","question","guillemotright","guilsinglright","hyphen","hyphen","period","colon","comma"]
sides = {"Left pairs": (left, middle), "Right pairs": (middle, right)}
f1 = SelectFont("Select Source Font")
f2 = SelectFont("Select Destination Font")
if f1 is not None and f2 is not None:
sourceKerning = f1.kerning
name1 = f1.info.familyName + "-" + f1.info.styleName
name2 = f2.info.familyName + "-" + f2.info.styleName
print "*** Transferring Kerning from font %s to font %s:" % (name1, name2)
for side in sides:
print side + ":"
for gn1 in sides[side][0]:
for gn2 in sides[side][1]:
if sourceKerning[(gn1,gn2)] is not None:
f2.kerning[(gn1,gn2)] = sourceKerning[(gn1,gn2)]
print "%s/%s: %d copied" % (gn1, gn2, sourceKerning[(gn1,gn2)])
else:
print "*%s/%s skipped, no kerning value found" % (gn1, gn2)
print "*"
print "done"
else:
print "exited"