Contextual alternate feature – confusion

Primary tabs

1 post / 0 new
Emma Williams's picture
Joined: 26 Apr 2013 - 9:32am
Contextual alternate feature – confusion


I have a font that i'd like to utilise the calt feature, and have found Thomas Phinney's article [], among others [] to be most helpful. YET I still can't get my head around writing the feature so that it creates a more 'random' outcome.

The details are:
– x3 variants for all characters
– x3 classes [00 / 01 / 02] including one of each character, 79 characters in total [A–Z, a–z, 0-9, punctuation]
– feature currently looks like:

feature calt {
lookup calt_one {
sub @set_00 @set_00' by @set_01;
sub @set_01 @set_00' by @set_02;
} calt_one;

lookup calt_two {
sub @set_02 @set_00' by @set_02;
sub @set_01 @set_02' by @set_00;
sub @set_01 @set_00' by @set_02;
sub @set_00 @set_01' by @set_02;
} calt_two;

sub @set_00 space @set_00' by @set_01;
sub @set_01 space @set_00' by @set_02;
} calt;

– the result being:

00 02 02 02 01 00 00 02 02 02 01 00 ...

+ after a 'space' the pattern resets

– I also have a fourth alternate for a handful of characters. I've not yet put them into the equation, is this something that is possible or do I have to have the same number of alternates for each character regarding this contextual random feature?

I just wondered if it's seemingly obvious what the mistake is that i'm making, and if anyone could possible help...?!