Actual kerning value

Does anyone have a snippet to get the kerning value for a pair in units?

What I mean is:

  • Call getKerningForPair on L and R
  • If not found, look up left kerning group and test against R
  • If not found, test L against right kerning group
  • If not found, test left kerning group against right kerning group
  • Replace 9.22337203685e+18 with zero.
kerning = font.kerningForFontMasterID_firstGlyph_secondGlyph_(fontMasterID, firstGlyph, secondGlyph)
if kerning > 10000:
    kerning = None
2 Likes