Typophile

f-ligature coding

Bendy

I've been working on some code and developed a liga feature that creates [fb fh fi figrave fj fk fl] ligatures by replacing the base form of f with a shortened-hood variant. I gather that for Mac compatibility I also need to include fi and fl ligatures as single glyphs.

There's also very narrow f alternates for next to the idieresis and icircumflex.

I have also developed some code that applies to [ff ffb ffh ffi ffigrave ffj ffk and ffl] or any number of fs preceding these letters. It replaces the initial f with a slightly lower-hooded variant (and any following ones that are followed by another f) and the final f by the shorter version. That way I don't need to create new glyphs for all these combinations and for the [fff] variants.

Here's the code:

feature liga {
  sub f'f by f.low;
    #lowers the hood of any fs except last in chain
  sub f' [b h i igrave j k l] by f.medium;
    #shortens the hood of normal height f
    #which is last in chain
  sub f' icircumflex by f.short;
  sub f' idieresis by f.shortest;
  sub T' h' by Th;
} liga;

Question is can anyone see any problems with doing things this way? And is there any way to neaten up the code further? I'm not a programmer but it works.

I haven't come across any problems doing this kind of thing.
Technically it's not a ligature, more of a contextual alternate, but so what.
Some foundries make these extra ligatures discretionary (dlig), but IMO liga is best, on by dfault.
You can neaten up the code by putting glyphs in brackets into a class -- this may help you manage kerning situations with capitals such as T.

sub T' h' by Th;

That's an Adobe trope.

In Mac applications that use the native system font rendering (through ATSUI or CoreText) on Mac OS X 10.4, contextual alternate features don't work. In 10.5 and 10.6, they "sort of" work but more complex contextual substitutions perform incorrectly. But a simple one like yours should work.

I propose a better solution:

feature liga {
lookup liga_contextual {
  sub f' f by f.low;
  sub f' [b h i igrave j k l] by f.medium;
  sub f' icircumflex by f.short;
  sub f' idieresis by f.shortest;
} liga_contextual;
lookup liga_Th {
  sub T h by T_h;
} liga_Th;
lookup liga_fifl {
sub f i by f_i;
sub f l by f_l;
} liga_fifl;
} liga;

The first lookup will work whenever contextual substitutions are supported (so it won't work in Mac OS X 10.4 or some other environments where contextual OTL rules are not processed).
The second lookup will always work because it's a simple substitution.
The third lookup will only be activated if the first lookup did not get processed, so it'll work in Mac OS X 10.4, or in situations when contextual substitutions don't work for some reason. If the first lookup worked, the third will be omitted (because the "f" glyph has been replaced by "f.medium" by the time the third lookup gets processed, so the third lookup won't have any input to process).

>That's an Adobe trope.

Nick, you mean I should put this in dlig, yes?

Thanks for pointing out the T kerning situation. I think the glyphs in the brackets are ok but the idieresis/icircumflex and itilde will need some attention.

Adam, thanks for the info about Mac systems, I don't know any of that kind of stuff so it's very helpful.

Captured from web.archive.org on 16 Jun 2010. view this capture