Is there an elegant way to automatically activate a set of features on export?
What I currently have is this:
for suffix in ['.ss01', '.ss02', '.ss03', '.ss04', '.ss05']:
for glyph in Font.glyphs:
if suffix in glyph.name:
print(glyph.name + '=' + glyph.name.replace(suffix, ''))
Then I copy & paste the output into a Rename Glyphs custom parameter.
The problem is that this doesn’t auto-update in case I change the glyph set, and it seems strange that I’d need a macro for this common (?) task.
The sets need to be applied in reverse order, otherwise e.g. the adieresis.ss01.ss02 will not become the plain adieresis. Also, they have to be separate custom parameters. Putting them into one custom parameter does not work.
Then that is your code for the parameter. Why change each suffix individually? That would potentially trigger lots of double substitutions, meaning if you also have .ss01 and .ss02 separately, they would keep exchanging each other.
With a wildcard, use *.ss01.ss02=* or if you want to stay in control, better spell out for each glyph, making sure each base glyph (without suffix) only appears once.
That’s not enough. As I want to activate all five stylistic sets, I’d have to have 13 of these lines to cover all possible combinations (given that the .ssXX suffixes are always sorted and contiguous). It’s a thinkable solution but I find it less elegant than having the five separate custom parameters as shown above.
No, that wouldn’t auto-update in case I change the glyph set.
Did you read my original post? What is your proposed solution for the given task, activating some stylistic sets on export? I don’t quite understand what exactly you recommend.
As I said, the proposed solution, at least in the current implementation, is to shift from thinking in stylistic sets to glyph sets. Because telling from the suffixes, it appears to be pretty complex.
Yes, you need to update the replacements when you change the glyph set, but trying to find the magic formula is a shaky road. So better decide which glyphs you want to see in your font export, and build the list accordingly. Pretty sure it can be automated.
If you want to have the features updated, you can force it with the Update Features parameter.
Thinking in glyph sets was the starting point, and I am trying to shift from thinking in glyph sets to stylistic sets, as described above. Never mind. Telling me just the opposite is not a solution to the original problem at hand.
There is a valid use case to include none exporting. e.g. you have a bunch of extra glyphs you one need in some instance. Then you set them to not export and they are switched in in those instances (the export flag is switched, too).
Wouldn’t it be more flexible to control which glyphs to export with another custom parameter though? Perhaps, another custom parameter could flag glyphs to exporting and then renaming should use them?
My logic is that the glyph set is controlled with custom parameters, whereas non-exporting flag is for deactivating sketches or otherwise unwanted temp glyphs which should be mostly ignored.