API Bug? font.setKerningForPair

Hi There!

I think I may have found a bug in the API.

If you use the font.setKerningForPair call, and the inputs for LeftKey , RightKey are a mixture of glyphs and classes (a glyph name on one side, and a class name on the other), I get an error regarding the FontMasterId of all things.

The error seemed to suggest that the setKerningForPair function failed to understand that it had received a master via FontMasterId at all.

I know this sounds peculiar, but no such master ID error is thrown when the font.setKerningForPair call refers to either two glyph names, or two classes. Only the mixture provides this error.

Is this expected, in some way I’m not realizing?

The error reads:

AttributeError: 'NoneType' object has no attribute 'id'

Can you post the exact call you are using and the full error message?
This line works for me:

Font.setKerningForPair(Font.masters[0].id, "@MMK_L_T", "a", -100)

For instance @GeorgSeifert, I can run:

for master in Glyphs.font.masters:
	print master.id 

and receive a list of the IDs for each master in my file.

But if I run:

for master in Glyphs.font.masters:

	Glyphs.font.setKerningForPair(master.id, firstGroup, secondGroup, -100)

I receive this error:

Traceback (most recent call last):
  File "<macro>", line 11, in <module>
  File "GlyphsApp/GlyphsApp/__init__.py", line 3352, in setKerningForPair
AttributeError: 'NoneType' object has no attribute 'id'

I assume the ‘id’ its looking for is the master.id? Which should have been passed to the function successfully.

You need to use


The method setKerningForPair needs either kerning IDs in the form of “@MM_L_T” or a glyph name. But rightKerningGroup returns the name of the group only: “T” (or whatever you have entered in the T) in this case.