Kerning Groups: Open/Close Locks via Script


I have a stylistic variant of a glyph that I want to have the same kerning values as the original across all masters. But after assigning a group to the original glyph, all the locks are opened, even though the glyph is the only one in the group. I feel like this is making things more complicated than they have to be.

How can I prevent this from happening?
Is there a way to close locks for a current glyph via a script?
Setting up the groups before starting to kern is not an option in this project.

Did you have kerning with the original glyph? Compress it then. Assigning a group alone will not change the kerning.

I don’t understand. Why is it the only one? And not both the original and the alternate glyph?

There is a four in the font that has been kerned with other letters. Now, an alternative to four was added, and needs to get the same kerning values as the original four. Therefore I assigned the group “four“ for the four. And then it is a group that only has exceptions (= open locks) and nothing else.

“Compress” would solve this?
What else is done by the “Compress” command?
Is it compressing the kerning of all the masters?

My question was, why don’t you assign the same group to both fours, the original and the alternate one?

Naturally, assigning groups does not change the kerning data in your font file. You had exceptions before, and since you did not change the kerning, you have the exact same kerning exceptions after assigning.

Compressing turns exceptions into group kerning where possible. So, four-@T -20 will be turned into @four-@T -20.

To be more precise, it attempts to turn:

  • group-glyph into group-group
  • glyph-group into group-group
  • glyph-glyph into group-glyph (!) ← these you may want to compress a second time

You can search in Window > Kerning for all pairs with four, select pairs, and compress selectively, or even change them manually, if you want to take no risks.

1 Like

Thanks, that already helps a lot!

You can search in Window > Kerning for all pairs with four, select pairs, and compress selectively

No, that does not work (1092). But it would be great to have this possibility to control to process!
Is it possible to implement it or make it work again?

This was the testing:
I have numbers without groups assigned from a third-party project. I assigned groups to two numbers (e.g. one/one four/four) and searched for “one” in the kerning window. I manually selected some pairs (not Cmd+a which I thought might affect the whole kerning) and pressed “compress”. It changed the pairs for “four” as well into class kerning. So it seems to be a general routine which is somehow scary if you want to rework (foreign) kerning let’s say surgically :wink:

1 Like

“Compress” does not check the selection, it always runs on the whole font.

By the way, to answer the original question, I have a graphical exception maker script in my Github repository. It lets you choose what kind of un/locking you want for a selected pair.


Hello! Is there a way to lock all selected glyphs at once? I have created a bunch of exceptions and now I want to delete them for a separate operation, couldn’t find a fast way of doing it. Thanks for the help!!

Have you tried the “Compress Kerning” command from the gear button in the Kerning Panel?

Hello Georg, yes, that doesn’t work since I actually have kerned the whole weight with exceptions — Like @T to @i is -30 but @T to /itilde (which is in the class @i) is adjusted to 0. I have bunch of exceptions like this that I would like to delete. I want /itilde (which is unlocked at this point) to be reverted back to -30 from 0. Is this possible?

Then you filter the kerning panel to only show glyph kerning (click on the locking glass icon) and remove them (all pairs that element in a light font with brownish color).

Yes but this shows all the glyph to glyph kerning, right? I have a bunch of glyphs that are not in groups and have kernings within themselves but are not “exceptions.” For example non of the numbers are in groups but they kern to eachother. When the cursor is in between lets say 6 and 7 I see the kerning value on the information panel and both locks are locked. However in the kerning panel, that pair is listed in the light font, brownish color.

I was wondering if there is a way to filter + remove only unlocked pairs. For example Toshi’s (and I think partially your) “Display Unlocked Kerning Pairs” script filters exactly what I need, however, still requires me to go in manually and lock them. If I have a lot of masters etc. this would take so much time. I was wondering if there was a tool to perform this task. Or else I would try to write one I guess, I want to see if there is another solution first before jumping into scripting. Thanks again for the support.

Can you please send me the .glyphs file to support (at) (this website without www). I will have a look.

I would assign a class to all glyphs (there is a script in my repository for that). Then compress the kerning again. All remains single pairs can then be deleted.

Might be a good workaround, will check that. Thanks!