Auto renaming glyphs on export

Hi
I have several character variants for each of my glyphs but in each of my exports I exclude some of them by using “remove glyphs”. The problem is that by using this method I lose the base glyph and also the variants’ naming is messed up.

For example for “h” I have 5 variants:
h
h.cv01
h.cv02
h.cv03
h.cv04

In export I remove the first two. This causes an error message of “Unknown glyph h”
I tried “update features” but it did not work.

Is there a way to rename the remaining glyphs automatically to form a consecutive set like this:
h.cv02 → h
h.cv03 → h.cv01
h.cv04 → h.cv02

Thank you

You can, for one, do this somewhat manually by adding a “Rename glyphs” parameter, with the same text you wrote in the last part of oyur message (syntax is h.cv02=h, with a new line for each substitution). Use this in conjunction with your Remove Glyphs parameter. Otherwise, you can use a script to do this manual part automatically upon export, writing your Rename and Remove parameters automatically.

Thank you Sebastian
Yeah I already did this manually but it is really difficult as there are many glyphs and I should detect them one by one. This causes errors.
I know some coding but I have never tried to write a script in glyphs and I don’t know the syntaxes.

Can you describe in detail what exactly your use case is? Then I could try and write something (not before tomorrow though).

I am working on a font that has West and East versions. between these two versions some signs are completely different and some are in common. I also have many ligatures with variants. My workflow looks like this:

Green ones will be exported in both versions. Pink ones only in the West version and Yellow ones only in the East version.

So in export I remove all the pink ones from the East version. And I remove all the yellow ones from the West version.

As I tried to put the greens first and the pink next, I do not have much problem with the West version. But the East version ends up with several missing glyphs and the variant numbers do not start from 1.

Hope this is clear.
Thank you again

That’s what the Rename Glyphs parameter is for, as Sebastian pointed out.

What’s the build version you’re using?
What exactly is your current setup of Rename/Remove parameters?

My glyphs version is 3.1
And my export custom parameters are like this.

Screenshot 2023-02-15 at 14.49.24

In the picture I posted before, I first rename:
a.cv02=a
a.cv03=a.cv01
a.cv04=a.cv02
a.cv05=a.cv03

And then remove
a.cv04
a.cv05

I had to rename and then remove because the other way I got the error message “Unknown glyph a”.

Sure this manual method works. But I have about 300 glyphs. Going through them one by one and manually detecting the changes and writing the rename and remove will take me so much time and it won’t be accurate. Also my glyph-set will change during the project and I have to modify the list again. This is why I need to make this automatic.

You have to define what glyphs need to go where. Not sure how that could be automated. Specially as the rules seem to differ from on glyph to the other.

Is there any way I can remove first? So I can just select all the pink and copy the names in Remove. Then I will just manually do the renaming of the yellow ones.

Otherwise the other solution would be to make 2 separate files which is less convenient for me.

Thank you all again I know this is kind of a specific case. But this can happen frequently while working with old sources. Each glyph might have several variants. And based on their dates one might want to export different versions.