In my current font family, I have some instances for which I want to deactivate a particular
calt substitution (not the complete
calt feature). I thought the easiest way to achieve this is to use the
Replace Class Custom Parameter to “empty” the class that triggers the substitution, like this:
"Replace Class" = "f_narrowdrop_trigger;";
However, Glyphs complains:
Well, I do have ‘name;code’ – my code is just empty.
I have another case for which I need to remove just a small handful of glyphs from a class. I don’t want to simply use
Replace Class with the glyphs omitted because that’s not Don’t-Repeat-Yourself and prone to errors. So, including the glyphs in question as a class (inside the main class), which is then emptied for certain instances, would be a solution but Glyphs will not allow me to do that.
Any ideas how to achieve this in Don’t-Repeat-Yourself style? Using (manually written, possibly nested) lookups?
You can make the parameter work with a dummy space character after the semicolon, but makeotf does not accept empty class definitions, and you will get an error at export.
I jst played around a bit more and found that a dummy space does not work but a dummy
# does. But, as you said, then the AFDKO complains.
Any ideas how to implement what I need to do?
Which Glyphs build are you using? Because the dummy space did work for me in 1270.
Instead of an empty class, put
.notdef in the class.
Oops, wait, now it works with a dummy space but it’s a moot point.
Cool, that works!
However, is it safe to do that? I just checked with TTX and saw that it ends up in the exported font file.
Is it perfectly valid in terms of OpenType specification? Even if it is, I am worried that at some point in the future the font may interact with some software out there may be assuming that .notdef cannot occur in these places, and then my users will be in trouble, and I will have a hard time trying to find the reason.
The only other way I can think of is to properly replace the feature code. But .notdef is a pretty safe bet, because it must be in the font, yet cannot be typed. I wonder if the feature code works in apps that actually display notdefs (like InDesign), but have not tried.
I am playing around with standalone lookups, which simplifies changing the feature on export, and reduces the Repeat-Yourself a bit.
Standalone lookups can’t be nested, right? That would be best way to practically eliminate code repetition but I couldn’t get it to work.
Lookups can’t be nested at all.
Just for the record, in case someone stumbles across this:
It turns out using standalone lookups are not feasible here. As we know, they are always processed first, and as we know, there is no such thing as a “feature order” anyway, although some experts will tell you so. Which makes the order of substitutions impossible to control (unless we write all lookups as standalone, of course).
I ended up using the
Replace Feature custom parameter for
calt. In the standard version of the
calt feature (in the Features tab), I am defining the classes for the to-be-omitted substitution inside the code, which means I do not need any additional
Replace Class custom parameters.
I believe you might as well define the class in the UI. An unused class is simply ignored by makeotf IIRC.
In my case, the problem is that the class contains glyphs that are deleted in these instances.
Strictly speaking, the class that triggers the substitution is defined in the UI because it does not contain any to-be-deleted glyphs. The two classes for the substitution are defined in the code.