I have some code to copy my kerning values from one master to another. In it, I can check if a value is the max int, i.e. is “unset”. (Below also my clumsy way to check that “max int”… any better way?)
#"kern" retrieved with font.kerningForPair... print kern # will print 9.22337203685e+18 print sys.maxint # will print 9223372036854775807 print int(kern) # will print 9223372036854775808 print kern == sys.maxint #BTW this will be False! if int(kern) - 1 == sys.maxint: # set "unset" kern
Now with the above check this here seems to unset the kern value in the target when used like this (I’ve also tried as copying the actual retrieved “unset” value instead of explicitly setting sys.maxint, same result):
font.setKerningForPair(target.id, leftKern, rightKern, sys.maxint)
In the tab everything looks okay in the masters, the Font Info shows the correct value. BUT: When I restart Glyphs and reopen the font, those kerns will actually be the maxint value, so have a kerning of 9223372036854775808, not empty (0)!
How can I “unset” the kern value programmatically, and why is the returned kern max value not equal to sys.maxint?