OpenType Feature — your help is appreciated

Hi,

I developed a very small font where I have ABCDEFGH as my basic glyphs. I would like to script a ligature sub… for example, if I type AG, I’d get ABCDEFG as result. if I type EH, I’d get EFGH.

I’ve tried this but it doesn’t work:

feature liga {

sub A G by A B C D E F G;
sub E H by E F G H;

} liga;

I read many tutorials online but still I’m struggling with this. Any help is appreciated, Thanks a lot.

—Nordine.

A ligature substitution substitutes one glyph for two or more. So you need to construct a glyph A_B_C_D_E_F_G (you can make it out of components), and another E_F_G_H, and then make the rule like this:

feature liga {
sub A G by A_B_C_D_E_F_G ;
sub E H by E_F_G_H ;
} liga ;

1 Like

Thanks psb6m! Yes, it can be done, but I was wondering if it can be just done by calling each component separately…

You can read about the various lookup types here. What you want, a lookup that substitutes several glyphs for several glyphs, is unfortunately not there. It will be tedious but economical in terms of space to do what you want with ligatures made of components.

1 Like

As @psb6m suggested, ligatures are typically multiple glyphs that get substituted by a single glyph. This is a many-to-one substitution.

OpenType does not offer a many-to-many substitution as you want, but it can be simulated by placing a lookup in the Prefix section and referencing that from the ligature feature:

Here, you match the pattern A G in the liga feature. The ' single quote marks the G as the glyph that should get replaced and the lookup some_ lookup after the pattern references a lookup that you have defined in the prefix which substitutes the G by all of the desired glyphs, including the G itself.

2 Likes

That’s brilliant, Florian!

One caveat, a thing I noticed about Adobe some time ago, borne out by a little testing just now: they seem to have disabled one-to-many substitutions for some reason. Maybe figuring it isn’t needed in English script? So it doesn’t seem to work in the Adobe suite.

In Adobe apps you need to activate the “World Ready Composer” to get one to many substitutions.

But I wonder what you are trying to do, other that totally confuse your users?

1 Like

Thanks a lot Florian! but still id doesn’t work for me at all… somehow Glyphs3 won’t compile the code :-/

What does it say?

Nothing… no message popup.

I’ll be darned. I wish I’d known that about the world-ready composer years ago.

It works but I need to hit space bar after each letter, whereas for the result it’s working.