Contextual Alternates Question

Primary tabs

5 posts / 0 new
Last post
Nick Curtis's picture
Offline
Joined: 21 Apr 2005 - 8:16am
Contextual Alternates Question
0

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.

paul d hunt's picture
Offline
Joined: 5 May 2005 - 8:44pm
0

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;

Nick Curtis's picture
Offline
Joined: 21 Apr 2005 - 8:16am
0

Thanks, Paul: that's an elegant solution, and it works like a charm.

paul d hunt's picture
Offline
Joined: 5 May 2005 - 8:44pm
0

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.

Chris Lozos's picture
Offline
Joined: 25 Feb 2004 - 11:00am
0

.