Set Kerning Pairs value

Is there such a script?

I would like to set the value of all/ or selected kerning pairs (Kerning Window) to a particular number. I wouldn’t not like to achieve this with kerning groups, this is regarding legacy fonts that need new kerning, but I would like to keep the pairs for reference (thus setting them to a number like /zero or /one)

I don’t think there is such a script because I wouldn’t know what the purpose would be. But you could write such a script. Should be easy to step through the kerning dict.

I had a concrete use-case in mind and I am very happy to hear that we can easily iterate thru the kern dict.

What is the name of the value that references the kerning dictionary?

Please refer to for extensive Python docs. You can see usage samples in my scripts.

@Rainer - I have browsed through this a couple of times now, but it is not as concrete as I would like.

Another question on the same topic:
In Glyphs can we show the contents of Kerning Dictionary as a String in the viewport and how.

I have a lot of kerning pairs and I want to display them all on the viewport, but I cannot copy them from the kerning dict.

Can you be more specific? What are you missing?

myFont.kerning is a nested dict, that means the top level keys are the master IDs, then the keys for the left glyphs and groups, then the keys for the right glyphs and groups, and its final value is the kern value. You can get the available keys with the .keys() method. Take a look into the script Delete Small Kerning Pairs, specifically at the method DeleteSmallKerningPairsMain(), for an example of stepping through kerning data.

Thank you, Rainer.

@mekkablue - I have been trying to crack this since you wrote me back with the dict. I simply can’t do it. Went as far as to iterate and extract all @MMK_L followed by all @MMK_R, but maybe I need some sort of /re to find the left glyphs and groups and their corresponding right glyphs and groups and extract them without the string “MMK_L” or “MMK_R” so as to be more useful.

I am thinking along these lines, though I have also tried other options like .split(), lists to tuples, enumerate() and ranges(value:value). I am sure this is due to lack of experience and probably can be done with each method, but still I wasn’t able to do it.

l1 = [ MMK_L_A, MMK_L_B ]
l2 = [ MMK_R_X, MMK_R_Y, MMK_R_Z]

result = [x+y for x in l1 for y in l2]

Would appreciate some help.

You can slice the string:

print myGroupname[7:]

Is that what you need?