Chaining contextual sub that should not work, why does it?

In my type Prima, I am making extensive use of chaining contextual substitutions (aka GSUB Type 6 lookups ).

It has been pointed out to me that the OT layout that I’ve created throws up errors in other type-making applications, namely that illegal multiple substitutions have been specified. However, it works in Glyphs and the compiled fonts work as expected in various shaping environments (Microsoft Word, Adobe, current browsers, FontGoggles).

When I look at the spec, I cannot find an example that shows what I am doing either, so I started wondering why it works, and what’s happening with other type-making applications.

In a nutshell, the definitions that I’ve been using follow this pattern:

@a = [a adieresis aacute abreve];
@desiredcontext = [n m r];
@joint = [joint.an];

lookup joint {
sub @a@desiredcontext by @a @joint ;
} joint ;

note that it makes no difference whether the joint is specified as a class or a single glyph, the results are identical as the classes that I’m using only ever have a single glyph in them:

lookup joint {
sub @a@desiredcontext by @a joint.an ;
} joint ;

Can anyone explain why this works in Glyphs and not in FontLab?
Thanks in advance!

This type of rule is something that can be expressed in an OpenType font, but for which the Adobe feature format does not have a syntax. Glyphs extends the feature code syntax to make it easier to author such rules:

lookup demo {
	sub [a b c]' [one two three] by [A B C];
} demo;

would have to be express in the regular AFDKO syntax like so:

lookup help {
	sub a by A;
	sub b by B;
	sub c by C;
} help;

lookup demo {
	sub [a b c]' lookup help [one two three];
} demo;

You can read more about this in the Handbook:

1 Like

Brilliant, I had a hunch Glyphs was changing something in the OTL somewhere, but wasn’t sure. I’ve had a look at the reference you pointed out, many thanks, I wasn’t aware of that.