Noob needs to learn how to code contextual alternatives

Hey, All. I’m working on an upright script right now that I would like to enlist OTF contextual alternatives in order to remove connecting tails off the last letters in every word. The problem is, I have no idea how to do this. I need instruction from the ground up; coding, where to code in Glyphs, how to build the alternate characters, etc.

Is there anywhere someone could refer me to that might give me the basic tools to begin understanding how to do this?

Thanks so much!

-Dan Ibarra

Search of init and final feature on There where some discussions about that.

@medial = [a b c d e f g h i]; # (and so forth:) letters that connect
@terminal = [a.fina b.fina c.fina d.fina e.fina f.fina g.fina h.fina i.fina]; # (and so forth:) letters that do not connect

lookup final {
ignore sub @medial’ [@medial @terminal];
sub @medial’ by @terminal;
} final;

Georg Seifert

Sorry, I’m not finding anything on that. Should I be searching “init feature”, “final feature”? As you can see, I am really starting at the ground floor.

I realize this code is obviously what I need to do, but I honestly cannot even decipher it, know where it goes, etc. SORRY!

Imagine I am using a car for the first time. I don’t even know which is the gas and which is the brake. Can someone direct me on getting started at that point?

I know I am trying to dive in over my head.

I found this

Georg Seifert
Okay, this is getting helpful.

This is a good start as well:

in the Typophile thread that Georg mentioned, Thomas Phinney writes this:

So, if it’s for use in InDesign, the easiest solution for you is to simply add a .fina suffix to the glyphs without connecting tails. For this, you can make use of the built-in batch renaming.

Afterwards, all you need to do is to re-build features: Font Info > Features > Circled Arrow button.

In InDesign, you select Automatic Form from the Positional Form menu in the OpenType options. Hope this helps.

Okay, just to reiterate and make sure I’m on the right page.

I have built additional glyphs that all contain no connectors on them (which is basically the entire font duplicated just without connectors) that will serve as the terminating glyph for each word. Each of these character should then be appended by the ‘.terminal’ suffix (or .fina if I’m feeling InDesign-y); ‘X.terminal’, x.terminal’, ‘Y.terminal’, ‘y.terminal’, etc. (Which I can do with batch renaming [awesome, Georg, thanks!]

Then in the feature panel I enter:

@medial = [a b c d e f g h i]; # (of course will all letters listed)
@terminal = [a.fina b.fina c.fina d.fina e.fina f.fina g.fina h.fina i.fina]; # (etc)

lookup final {
ignore sub @medial’ [@medial @terminal];
sub @medial’ by @terminal;
} final;

And hit the circular button to propagate.

Output the OTF and it should work?

The code looks fine.

But you need to hit the compile button, not the arrow button.

Better yet, you hit the PLUS button and pick CLASS, and an ‘xxxx’ will appear. Double click the ‘xxxx’, type ‘medial’ instead, and in the text field at the top, you type: a b c d e f g h i j k l m n o p q r s t u v w x y z

Repeat the process for the terminals: plus > class > ‘xxxx’ > rename to ‘terminal’ > and you type: a.fina b.fina c.fina d.fina e.fina f.fina g.fina h.fina i.fina j.fina k.fina l.fina m.fina n.fina o.fina p.fina q.fina r.fina s.fina t.fina u.fina v.fina w.fina x.fina y.fina z.fina

Now, for the following part, you need to pick or create a feature. In your case, a good idea is ‘calt’ (=contextual alternatives). This time, it’s: plus > feature > ‘xxxx’ > rename to ‘calt’, and then copy and paste this part into the top text field:

This is what it should look like now (the indentation of ‘ignore’ and ‘sub’ does not matter):

Now, hit the Compile button (sorry for my confusion in my previous posting). If no error message appears, you’ve done everything right. If an error message appears, please copy and paste it into this thread.

It works and it is wonderful. Thank you so much. Now I’m feeling cocky and may have to take on a few ‘initial’ glyphs.

I am finding one discrepancy though. When working with the font, it seems that I substitute an alternate character at the end (‘r.ss01’ for ‘r’ for example) my font applies ‘r.terminal’ instead of ‘r.ss01.terminal’

Any suggestions?

This depends on the order of the feature. If the salt feature precedes the ss01 feature, the r -> r.terminal is already done when the ss01 features is locking for the r. So either you put the salt feature after the ss01, or even better change the name of the r.ss01.terminal to r.terminal.ss01.

Georg Seifert

That did it. Thanks!

Gah! You guys are rockstars. I had been scouring the internet and typophile for this very thing to no avail.

This is exactly what I needed with a wonderful, easy to understand explanation. Much, much thanks!

You’re welcome.
Can we see the font when it’s finished? :slight_smile:

Sure! Just finishing up the lowercase… which means only the entire uppercase and all the punctuation left. Psh. Easy right?

This is just what i need, thank you!