Integrate code from one feature to another

Is there a way to add code from one OT Feature to another?
It’s seems that only aalt can use :

feature xxx;

I’m looking to try a workflow to build Stylistic Sets usings multiple Character Variant features.
For example, I would like to generate the code for my .ss01 by merging code from .cv01
, .cv02 and .cv03

You cannot integrate code from automatically generated features. If the cv## code is manually written, you can wrap the sub … by … rules in a lookup block (lookup XYZ { … } XYZ;) and then invoke that block in other features like so:

lookup XYZ;

where XYZ is a placeholder for a more descriptive lookup name.

Could it be possible to add an option to not have to wrap OT code in lookup for that ?

I have a project where one of its stylistic sets is a merge of many.
For example, ss04 = ss01 + ss02 + ss03, where ss01, ss02, and ss03 are autogenerated.

In my export process, for some instances, I need to remove glyphs from these three stylistic sets, and this is not a problem because they are autogenerated. However, for ss04, it is really boring because I have to manually copy and paste code from the others and then manually remove lines where a removed glyph is involved.

Something like that could be really helpful :

include (ss01, ss02, ss03)

The issue is that a feature like ss01 could consist of multiple lookups. That is not common, but possible. And then you cannot include the feature in another by referencing a single lookup. Thus, Glyphs cannot simply expose a lookup for each automatically generated feature.

Still, the need for this does come up from time to time, so we will look into offering something that makes this more seamless.

Even if ss01 is autogenerated ?

Difficult to say “absolutely never” since different scripts might require more complex substitutions for some pairs. Plus, lookups are optimized on exports, and that adds a lot of additional uncertainty. Even if I could formally proof that autogenerated ss## features will always use just a single lookup, then there would be other uses cases where this special handling would not work. So it’s better to find a general solution.

Maybe it could be something at the Glyphs level, executed at export like:

  1. Extract feature tags from include(ss01,ss02,ss03)
  2. Copy the feature.code from each of these
  3. Paste it into the mother feature
  4. Remove include(ss01,ss02,ss03) from the initial feature.code

But I guess this is not the most optimised solution, since it will generate duplicate code instead of re-using lookups.

1 Like