Switching two glyphs + kerning pairs

Hello, I have some practical questions. :slight_smile:

I have created a font family with a bunch of variants. At the end, I would like to change some alternates (e.g. “a.ss01”) into main glyphs (e.g. “a”). So, for exemple: [a ↔ a.ss01]

  • First question: is there a script that allows me to easily change the name of two glyphs at the same time?
  • Then, my problem is that I have already done the kerning. So my second question is: is there a more efficient solution that allows me to change all the kerning pairs from one glyph to another, rather than copy/pasting them to a page like TextEdit and changing them using CMD+F?
    I hope this is understandable?

Thanks so much in advance! Any faster options would be great for me :slight_smile: I’m pretty sure there are scripts that could help me but I need you to find them.

Do you want to change the glyph names inside Glyphs or do you want to write an OpenType feature to switch between alternates for your font files?

You could use Edit>Find> Find & Replace (Cmd Shift F) to change the names of your glyphs. Say you have multiple /a alternates named .001, .002, .003, and you want to make them .ss01, .ss02, .ss03.
You could;
Find: 00
Replace: ss0

For the OpenType features: Font info (Cmd + i)> Features> Add a Stylistic Alternates/Set feature by clicking the plus button then write the code inside the feature.


sub a by a.ss01;
sub a by a.ss02;
sub a by a.ss03;

To swap between 2 glyphs inside the editor there is a script called Swap Glyphs:
(You can download Mark2Mark’s scripts via the plugin manager)

To use the same kerning for all your alternatives you should set them into the same kerning group: Kerning | Glyphs
And you can also copy and paste kerning values from kerning window (Cmd Opt K)

1 Like

If I understand correctly, you just want the shape of a.ss01 in the regular a glyph? Then you can just rename the glyphs, kerning and groups will be updated automatically. Just do a search replace on ss01 to something like ss01xx, so when you rename a etc to a.ss01 you won’t get a duplicate warning.

1 Like

Thanks @obiobik for your quick answer!

Actually, my request was to change the name of / to swap two glyphs (e.g. glyphs named “n” become glyphs named “n.ss01” and vice versa, see the screenshots), not really to create a new alternative. So I think Mark Froemberg’s script would be a good solution. I’ll check it out!

As for the kerning pairs, the problem I’m afraid of is that when I change the names of my two glyphs, they keep their respective kerning pairs and, since their kerning pairs are linked to a bunch of other glyphs, it will mess up all my kerning. For example by becoming the new “n”, the “n.ss01” will no longer stick with the kerning pair to its right. I’m struggling with this because this change will potentially, once again, impact many other glyphs.

Swap Glyphs script also swaps the kerning groups but then you may also need to change the kerning groups of your accented /n s with the new name. I hope that works.

@obiobik thanks once again!
Yes, I just tested it, it’s great! But, as you said, I have to swap all the accented glyphs by hand. If there is another script, I’d be happy to know it aha, but this is already great for me. It saves me long minutes of work ;).

Thanks! The problem with this method - I thought about it at first - is that I only swap the name but not the kerning groups. My idea was to find a good method that allows me to synchronize the name + kerning :slight_smile: Mark2Mark’s GLYPHS SWAP is great!

You also can do that on export with a “Rename Glyphs” parameter in an instance.

Oh, thank you for this other option! I think I have too many alternatives that are involved, and I’d like to be able to work with those swaps in my glyph file. But I’ll keep it in mind too!