Typophile

{calt} code for one to many substitution workaround

Chris Lozos

I have been putzing with some feature code to try to do what seems like a simple thing, replace 3 glyphs with 3 other glyphs contextually. Some day maybe Adobe et al will allow for one to many substitutions.
In the mean time, here is a screen grab of my code. The only way I got it to work was to make a succession of 3 lines of code to do what it seems one line should work. I am sure Karsten or someone else has done it far more elegantly so I am hoping they will show us the better way to do it.
In the following, I am substituting the combinations TT, TTY, and TY with alternates for better spacing. I am repeating similar code for smallcap version in succeeding lines. The last few lines are just part of another substitution.

Here is hoping you Obbeewon code warriors have a better way than my hack.

Thanks,

ChrisL

The first line: sub T’ T by T.alt2;
Looks like you’re substituting instances of two T’s with a single “TT” glyph (T.alt2), and this alt is a ligature?

Then in the second line you’re substituting instances of T.alt2 plus T.alt plus T plus Y with T.alt3.

The third line substitutes instances of T.alt2 plus T with T.alt.

Have I interpreted this correctly? Correct me if I’m wrong.

It’s a bit confusing not knowing exactly what these alternate glyphs look like, but a few things jump out at me here: What are the apostrophes (quotesingle) for? I’m accustomed to using the quotesingle after the key glyph in a class definition for kerning, eg:
_kern01: a’ a.1 a.2 agrave aacute acircumflex adieresis [etc etc]

In that example a.1 and a.2 are stylistic alternates, and the other a’s are the familiar western diactritics.

But in the code box for defining OT features I’ve never found quotesingle to be of any use. This is how I code similar sequences to your calt examples:

sub T T by T_T;
sub T T Y by T_T_Y;
sub T_T Y by T_T_Y;

That coding works, compiles without a hiccup. It’s good practice by the way to use an underscore in the names of ligature glyphs to avoid coincidences with standard unicode glyph names.

j a m e s

Also, also three sample lines I’ve written above belong in the LIGA feature rather than CALT. CALT you only use for one-to-one substitutions, eg: sub a by a.2;

j a m e s

I think Chris (“the Salmon”) is not substituting a single glyph with two T’s for two, but rather an alternate form of T for one of them, much like it’s becoming popular to replac

Captured from web.archive.org on 3 Dec 2008. view this capture