Problems with lookups/feature order

daverowland's picture

Hi

I'm having trouble getting my latest font to work properly. It's a script font with various stylistic alternates, contextual alternates, swash etc. etc. My probelm is that for, say, ss01 to work properly, calt needs to be before it in the features list, but then there is a lookup in calt which doesn't work properly with ss01 unless ss01 comes first in the features list. I've confused myself with that sentence so I'll try showing the problem with the code:

feature calt {
sub @ovw @changeafterovw' by @afterovw;
sub @changetbeforetall' @tall by @tbeforetall;
sub @tbeforei i' by dotlessi;
ignore sub @connectionafter o';
sub o' by o.init;
} calt;

feature ss01 {
sub @droopable' by @drooped;
} ss01;

sub @ovw @changeafterovw' by @afterovw;
My class names are probably a bit confusing, but the general idea is that letters following a letter with a high lead in change to an alternate form:


See second o and k have changed form. This is all good and works fine.

sub @changetbeforetall' @tall by @tbeforetall;
is a lookup that changes |t| and ligatures ending in |t| and alternate forms of |t| to versions with a shorter crossbar should there not be enough room for it - ie. when followed by a tall letter @tall. The i doesn't count as a tall letter because it just changes to a dotless i:

Now the ss01 is a stylistic set where droopable letters droop:


and you can see that |t| is a droopable letter. When calt appears before ss01 in the features list, the image above is the outcome, but when ss01 comes first, the |t| before a tall letter automatically droops because it hasn't been told yet that it should shorten its crossbar for the tall letter.

This wasn't a problem as I just put calt first and everything was working ok, but then I added an initial form of |o| to be used when there is no lead in - ie. after spaces, some capital letters, drooped forms of regular letters. To do this I put all the letters with a connector to the right in one class, and got |o| to sub for |o.init| in every situation apart from when it follows a connector. Problem is because calt comes first in the features list, |o| seems to think that drooped and swash letters before it are their original forms (ie with connectors) and isn't substituting for the initial form:

Is there a way round this? I'm guessing it's something to do with lookups but I'm not very good with those. Any help would be very much appreciated.

Cheers
Dave

daverowland's picture

Hmmm, I've just found a way to sort it. I just put the
ignore sub @connectionafter o';
sub o' by o.init;

in the stylistic sets and swash features too after the rest. It works but it seems a very messy way of doing it. Anyone got any better ideas?

Syndicate content Syndicate content