Re-encoding with custom parameter


When starting with about two years ago, I made the painful discovery that you can have 1 unicode per character only. But at least it was possible to assign the same Unicode to more than 1 character.

Now I actually have a use case for the latter, because I am working on a font that has instances for a document and a UI version. There are 4 encoded characters that have 2 versions. With the “Keep Glyphs” parameter one version for the document instances, the other for UI instances. But in the mean time the GlyphsApp UI bars me from entering the same Unicode twice.

So I tried to use the “Reencode Glyphs” parameter in the instances for the UI fonts

        "Reencode Glyphs" =         (
            "llvocalicUIbeng=09E1,rrvocalicvowelsignUIbeng=09C4,lvocalicvowelsignUIbeng=09E2, llvocalicvowelsignUIbeng=09E3"

This tries to re-encode llvocalicbeng with U+09E1 and so on. It has no effect, these 4 unicodes are missing from the fonts.

In the mean time I discovered that I can bypass the UI and assign the unicodes twice with Python and the generated UI fonts have the desired cmap. This works for my current version 2.4 939, but I suppose there is no guarantee that it continues. Not to mention there is a side-effect in that when you have 2 glyphs with the same Unicode, it seems impossible to edit the first one. Whatever I try to view llvocalicbeng in the edit tab, I end up with llvocalicUIbeng ;-(.

So I guess the “Reencode Glyphs” is the best option moving forward. But I dearly want to know if works at all, or whether there are hidden assumptions that are required to be met, before this does something ??

Jelle Bosma

I just tried and it worked for me. Can you send me the .glyphs file that I can have a look?

On its way…

I send the file to info at … (edit) on the 23th. If that is the wrong email address, let me know.

Use support@... and we both receive it.

I had received it but didn’t had time. Thanks for the reminder.

I had a look. The export works fine for me. Only the custom parameter is malformed. It needs to have one entry per line.

But I would use the Rename Glyphs parameter instead of the Reencode Glyphs.
And set the ‘UI’ variants to not exporting, by renaming it, the not exporting setting will be put on the original glyph. that way, only one of the pair will end up in the final font.

Any you don’t need to worry about he alternate glyphs in Feature code.

Thank you for looking into it: I have it working now.

You may want to update the manual. It says: “Takes a comma-separated list of ‘glyphname=unicodevalue’ pairs, e.g., ‘smiley=E100, logo=E101’.” So I used comma’s.

I afraid I will stick to re-encoding, if only because my feature sources have been debugged with the alternates already.

Thanks for pointing that out, will roll into the next update.

Haha, after fiddling half an hour finding the cause of why that Reencode Glyphs doesn’t work, I stumbled upon this. Thanks!