Features: Use Instance as Class for features

Is there a way to use an Instance as a Class for features?

I do not understand the sentence. What are you trying to achieve?

Sorry about the vague question. It’s ok if there is no general answer. I might just need to learn more about opentype feature programming.

Anyway, assume there is a “Custom Axis” that defines a non-standard characteristic (not weight, not width) between two masters. One master has the Custom Axis value of 0 and the other master has a Custom Axis value of 100. Now assume there is an Instance defined at the Custom Axis value of 50 (or any other number between 0 and 100), which defines the shape of all glyphs in the font at that value. In an Opentype feature, a “Class” is a list of glyphs to be used in operations, for example substitution. So the question is, is there a way to name all the glyphs in the instance with a unique name so that they can be used as the names in a Class to be used in a feature that could substitute all the glyphs in one instance for all the glyphs of another instance when the feature is invoked.

As an example, let’s say there was a feature that would make all the weights in a font slightly lighter or slightly heavier for readability or other use. First, separate lighter and heavier instances would be created. These could be exported as separate files, but this would create 3 times the files and possible confusion as to what the extra weights were named and used for. Alternatively, open type features called “slightly lighter” and “slightly heavier” could be made that would substitute the standard light, medium and bold instances of a font for slightly lighter or slightly heavier ones. How would something like this be done?

Perhaps this is beyond the scope of a question for this forum. Thanks for any advice that might help me learn about how to do things like this.

This would not be the job of a feature, that is a different instance (or slider position in a variable font).

Glyph names are the same throughout all instances, unless you rename some with a Rename Glyphs parameter. Same is true for features, they are the same throughout all instances, and they also work within an instance, i.e., an OT feature cannot exchange glyphs from one font with glyphs from another. That would require the user to switch fonts.

You would somehow have to make sure that the replacement glyphs are in the same font (=instance). So you could have copies of your letters as a stylistic set (e.g., A.ss01, B.ss01 and so on), and apply a Local Interpolation parameter to them with an include: directive.

But again, for the user, this is unexpected, and therefore will be pretty confusing. I would rather add a separate family and indicate in its name that it is slightly bolder or lighter.

Thanks for the detailed response - lots to think about.

I’m looking for something similar, I want to export all the instances as an Stylistic Set of a new font.
I’m finishing a family based on the BD blackletters with 18 weights and I want an specific weight with an Open Type feature to create an incremental effect in a word or sentence. I already have the Open Type, an adaptation of a randomized script.
The effect I want to achieve is Similar to the one in the image I attached:

The easiest way would be to write a Filter plug-in that makes the suffixed duplicate and add its name to the OT classes.