googlefonts / glyphsLib

A bridge from Glyphs source files (.glyphs) to UFOs
Apache License 2.0
178 stars 51 forks source link

masters or intermediate layers can also be marked as "alternate" #983

Open anthrotype opened 4 months ago

anthrotype commented 4 months ago

I just found out about this, which is a bit surprising to me at least:

https://handbook.glyphsapp.com/switching-shapes

A master layer can also be designated as an Alternate layer. For that, Control-click or right-click a master layer in the Layers palette and choose Alternate. Configure the axis range of the master layer like a normal Alternate layer. Then, add a new layer to the master, mark it as an Alternate layer, and leave both the min and max fields empty. This renames the new layer to []. Place the alternate outline on the master layer and the normal outline on the [] layer. Whether the master or a backup layer is converted to an Alternate layer is not relevant to the exported fonts; it is purely an organizational choice within Glyphs.

glyphsLib doesn't currently support this situation because it assumes master layers are one thing, alternate or bracket layers another (the latter are handled separately and at a later stage in the builder).

I just file this issue for reference, but I don't plan to work on this. The code handling bracket layers is already complicated enough, and don't see much use in this. If Glyphs.app doesn't care (see "it is purely an organizational choice") then if one does care about building with glyphsLib/fontmake then they can reorganise the layers as glyphsLib expects, i.e. by avoiding to designate master layers as alternate/bracket.

anthrotype commented 4 months ago

Turns out intermediate ("brace") layers can also be marked as alternate ("bracket") layers:

A layer can be both an Intermediate and Alternate layer. In that case, both the square bracket Alternate name ([…]) and the curly brace Intermediate name ({…}) are displayed in the Layers palette. Double-click either one to edit its settings.

but glyphsLib doesn't currently support that either as far as I can tell. I get errors like:

KeyError: "glyph named 'idotless.BRACKET.varAlt01' already exists"

This one seems to be legitimate use case and we may want to fix/add support for.

schriftgestalt commented 3 months ago

The Glyphs 3 handles that already. At least on the GSLayer side.

schriftgestalt commented 3 months ago

I use bracket on master layer quite often. That way you see the switched shape in the font view (e.g. the dollar without the full bars) for the bolder masters. It looks like this in the layer panel:

Bildschirmfoto 2024-03-07 um 11 33 27