Alternating contextual alternatives

Hi everyone,

I’m working on a project where I need to alternate between two sets of glyphs for uppercase letters. One set is the regular uppercase letters (A-Z), and the other set is a stencil version (A.ss01, B.ss01, etc.).

The client wants the alternation to occur as the user types, with the regular font used for odd-positioned letters (1st, 3rd, 5th, etc.) and the stencil font used for even-positioned letters (2nd, 4th, 6th, etc.).

Here’s an example:

  • TEST would become T E.ss01 S T.ss01.

The following seems to work

sub @DEFAULT @DEFAULTby @ALT1;
sub @ALT1 @ALT1by @DEFAULT;

, but I can’t get the ETC class to work and ignore SPACE. Currently it resets the alternation when a space separates the word.

Could anyone help?

I’ve not tried this, but can’t you include SPACE in both @DEFAULT and @ALT1?

This worked thank you!

The “space” is handled differently in some apps, so using it in OpenType feature context doesn’t always work. So you need to test all places the font should work.

See the tutorial Advanced Contextual Alternates. it has an in-depth discussion.