My Robofab kerning scripts don't work on Glyphs

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"

What are the error messages you get? Did you install the modules in the Preferences?

I don’t get errors. It just does not transfer the kerning pairs to between the fonts. Yes, the modules are installed.

Well, you can debug by putting print statements in the code. That way you can find out what is happening when exactly.

I will try to find the problem but the script runs smooth on Fontlab, so I thought you might know what was wrong with it.

The API of Fontlab is quite different to the Glyphs API. RoboFab tryies to smooth this over but it might fail here and there.

I had a look at the script. It seems to work for me. Do you get anything in the macro panel?

I will check again as soon as I can. When I tried, the script seemed to work but the pairs didn’t get transferred to the other font.

The problem is that you are only looking for kerning pairs between glyphs but the original font has most likly kerning between groups. So you need to search for the class pairs too.