Forum

» Glyphs

Random Contextual Alternates.

altergrounds
Forums Member
#1   Posted: 16 Nov 2011 23:01   Edited by: altergrounds
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
Georg Seifert
Admin
#2   Posted: 19 Nov 2011 00:59
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.
mekkablue
Team member
#3   Posted: 24 Nov 2011 15:34
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
Username Password
Only registered users are allowed to post here. Please enter your login/password details upon posting a message, or sign up first.