Contextual Alternates for Contextual Alternates?

Hello fellas!

Quick one hopefully (see attached image).

My goal is to create contextual alternates so that my lowercase i and l (in a monospace style) are never next to each other, and are replaced with a straight forward i, l (set as contextual alternates).

You will see my goal has worked successfully with my uppercase “British Isles” where the I is substituted in ITI but not in “ISLES”.

I wanted to ensure that these alternates work for the following:

  1. Caps I: IIIIIIII (and so on)
  2. Lowercase i: iiiiiii (and so on)
  3. TI Combo: TITITITITITIT (and so on)
  4. Lowercase l and i Combo: lilililililiil (and so on)

It’s mainly the 1-3 I have issues with.

Below you will see the second l in ‘hello’ needs to be my l.alt, and the l in ‘helium’ also needs to be my l.alt

Here’s my current .calt Feature code:

sub T I’ by I.alt;

sub I’ T by I.alt;

sub q j’ by j.alt;

sub i l’ by l.alt;

sub l i’ by i.alt;

sub I’ I’ by I.alt;

sub i’ i’ by i.alt;

sub l’ l’ by l.alt;

Thanks guys!!

When you want to substitute two glyphs, you need to do it in steps:

sub l' l by l.alt;
sub l.alt l' by l.alt;

And you can also group glyphs so that both l and i situations work in one go:

sub [i l]'  [i l] by [i.alt l.alt];
sub [i.alt l.alt] [i l]' by [i.alt l.alt];

But the smartest solution is to declare named groups first. If you decide to add accented i’s later, it’s easier to manage, as you only need to edit the content of the groups once:

@ilCalt_off = [i l];
@ilCalt_on = [i.alt l.alt];
sub @ilCalt_off' @ilCalt_off by @ilCalt_on;
sub @ilCalt_on @ilCalt_off' by @ilCalt_on;
1 Like