New to Typophile? Accounts are free, and easy to set up.
I don't get out much, so pretty much everything I know about OpenType programming, I've learned here. Ergo...
I'm working on a font that requires contextual alternates for certain characters (A, H, I, M, N, T, X and any accented characters associated with same) preceding EVERY instance of S, X, Z, s, x and z. I'm not sure what the easiest way to accomplish this is, and how to avoid recursive problems with X.
Any suggestions would be greatly appreciated.
24 Jun 2010 — 8:08pm
Make three classes, for example
@pre = [A H I M N T X]; # the glyphs you want to substitute out
@post = [A.alt H.alt I.alt M.alt N.alt T.alt X.alt]; # the glyphs you want to substitute in go here
@context = [S X Z s x z]; # the glyphs that trigger your substitution go here
Then in your Contextual Alternates (calt) feature use the following code
feature calt {
sub @pre' @context by @post;
} calt;
25 Jun 2010 — 9:23am
Thanks, Paul: that's an elegant solution, and it works like a charm.
25 Jun 2010 — 10:49am
you're quite welcome. This may not be all the code you need, but it provides the most basic functionality for what you were asking about.
25 Jun 2010 — 10:54am
.