Instances and Layers

I have a font with one master. For testing purpose I have multiple variants for some characters on multiple layers. Is it possible to generate different instances with the different variants?

For example: My Master is Regular. For the character “a” I have two additional layers. I want to generate three instances: Regular, Regular Alt 1 (with character “a” in Layer “Alt 1”) and Regular Alt 2 (with character “a” in Layer “Alt 2”).

Or is there an easier way to test different character variants (but keeping them in layers)?

Thanks!

Best solution is probably to turn the layers into separate glyphs, and then, use the Rename Glyphs parameter to switch them in. In my repository, there is a script called Features > Stylistic Sets > Create .ssXX glyph from current layer which could help you with that.

Yes, thats is the way I’m doing it right now. But I find it a bit inconvenient. Would be nice if one could just add an instance, let’s say “Regular Alt”, and Glyphs would automatically pick all layers which are also called “Regular Alt”.

Another way would be the LayerGeek plugin with a value like this:

setAnchors_(None);setComponents_(None);setPaths_(None);appendLayer_(Layer.parent.layers[3]);include:R

What it does: It deletes all anchors, components and paths, and then adds the content of another layer, in this case the layer with index number 3, and it does so only in the glyph R. Instead of 3, it is probably best to use the actual layerId of the respective alternate layer.

The layer name would be a good way to handle this.

How? AFAIK the layer is inaccessible via GSGlyph.layers["name"]. After all, two layers may have the same name.

The glyph has a method: g.layerForName_(name). It just retunes the first it finds, that should be OK for this purpose.

edit:
I just added that the g.layers[name] will work.

1 Like