Ligtures and contextual alternate naming convention

Hello,
I have 2 questions about ligatures with contextual alternates. Despite reading all the related questions, none of them answered my questions exactly.

My typeface has contextual alternates with 1 default and 2 versions (alt01 and alt02). I’m trying to add ligatures, with 3 versions of each ligature for different class combinations (ligature default, ligature.alt01, ligature.alt02).

How to name the alternate ligatures?
For example, if I want an alternate version of J_E (alt01) ligature, should it be named J_E.liga.alt01, J_E.alt01.liga, J.alt01_E.alt01.liga, or simply J_E.alt01_alt01 without “liga”?

Placement of special ligatures: should these ligatures be placed in the dlig (discretionary ligatures) feature or just the liga feature? This is a bit unclear for me.

This is how I’ve named and structured my code (showing only J_E ligatures for brevity):
In the dlig feature:

lookupflag IgnoreMarks;
sub J E by J_E;
sub J.alt01 E.alt01 by J_E.alt01_alt01;
sub J.alt02 E.alt02 by J_E.alt02_alt02;
sub J.alt01 E by J_E.alt01_alt01;
sub J E.alt01 by J_E;
sub J.alt02 E by J_E.alt02_alt02;
sub J E.alt02 by J_E;
sub J.alt01 J.alt02 by J_E.alt01_alt01;
sub J.alt02 J.alt01 by J_E.alt02_alt02;

I appreciate any answer, correction or helps.
Thanks in advance!

That depends on the order of the features. There are two options:

  1. you have a bunch of ligatures and alternate versions of them. That would mean you have “J_E” and “J_E.alt01” glyphs and the “alt” feature needs to come after the liga/dlig feature.
  2. Ligatures can be build from different combination of alternate glyphs (as in your case). Then the “alt” features need to come before the liga feature. In this case you collect all suffixes from all base glyph and connect them by an underscore and append it to the base liga name: “J.alt01”+“E.alt02” > “J_E.alt01_alt02”, “J”+“E.alt02” > “J_E._alt02”. For glyphs without a suffix, you keep the “empty string”.

That depends what you need. The “liga” feature is on by default, “dlig” is not.

1 Like

Thank you @GeorgSeifert for your quick reply. Finding exactly what I needed with J_E.alt01, was very helpful.