Random Contextual Alternates

Hello all,

I’m very new at programming open type features and can’t seem to wrap my head around this.

I’m basically looking to build alternate glyphs for sixteen characters in a font. Most will only have one alternate except for the e, which will have two. The effect is to have a semi-randomized replacement of those particular characters so that repeats in a word are likely to have some variation. I’m especially interested in double letters like in bookkeeper.

The exact alternate characters I have are abdeefgiklmnoprst

Poking around I found this on typophile regarding the calt feature but I’m stuck as far as how to apply it because a) it’s set up for a font that has several alternate glyphs for each character, as opposed to one with just a few alternates, and b) it’s just straight code and I’m still not sure how to enter that into Glyphs.

The code is

feature calt {
sub @set_1 @set_1’ by @set_2;
sub @set_2 @set_1’ by @set_3;
sub @set_3 @set_1’ by @set_4;
sub @set_4 @set_1’ by @set_5;

sub @set_1 space @set_1’ by @set_2;
sub @set_2 space @set_1’ by @set_3;
sub @set_3 space @set_1’ by @set_4;
sub @set_4 space @set_1’ by @set_5;
} calt;

So the feature would be calt, but when I try to create a feature and name it calt it x’s back out and I’m not sure what parameters to add and where.

Also would I have to define classes for set_1 and set_2, and could I define the characters I want affected or do I need to have the same amount of alternate glyphs for each character?

If I do need an alternate glyph for each character does that include numbers and punctuation as well or just letters?

Looks like what I need is an Open Type for Dummies book or something because most of what I’m running across seems to be written in greek.

Thanks,

  • Jonathan
1 Like

Sorry for not answering earlier. The code depends heavily on the glyph set and the desired effect. So you need to figure it out and need some basic understanding.

I plan to write a script that generates a feature code like that but I don’t know when I will find time for it.

I have scripts that ‘fill up’ your ssXX classes. Maybe they are of use for you. But Georg is right, every OT problem needs an individual solution. One size does not fit all.

I usually include the space in all classes, so replacements work across word boundaries while the code is still kept simple. The scripts do just that. Have a look and experiment.

https://github.com/mekkablue/Glyphs-Scripts/tree/master/Stylistic%20Sets

im currently doing something similar on a Arabic typeface.
the feature is working; However, i dont have the choice to turn the feature on and off.

the feature is functioning on InDesign although i have not activated the Contextual Alternate feature from Opentype

i dont seem to have this problem when i generate the font on Fontlab

maybe im doing something wrong, does anyone else have this problem?

The calt feature is activated by the “Contextual Alternate” menu in Indesign. There is no difference between the fonts from FLS and Glyphs.

Could you send the font to support at this domain? Then we can have a look.

Contextual Alternates are on by default, unless you changed InDesign’s defaults, that is.