OpenType Liga feature limits

kostas's picture

hi, everybody
i just completed a font with about 1200 ligatures (Grec du Roi) and I need to know if it's possible to make all that substitutions in one Liga feature. Is there any limit? Can I add more than one Liga feature in the same font (Liga1, Liga2...)?

Konstantinos Siskakis

John Hudson's picture

You can put all the ligatures into one liga feature, but you may need to break them into multiple lookup subtables. There is no practical limit on the number of substitutions you can associate with a feature (a feature is just a tag), but there are limits on the number of substitutions you can put into a single lookup table.

What software are you using for the OpenType Layout?

kostas's picture

Dear John
thanks for the answer. I can not understand the term "multiple lookup subtable".
Maybe it's something not for beginners! Any information on the web?
(I use FontLab Studio).
Thanks a lot

Konstantinos Siskakis

Typograph's picture

A single Sub would be sub A By B
A multiple Sub would be
Sub A By A B C
Sub A B C By A
you cant mix single with multiple subs in one lookup

Regarding limits
there are some limitations
to meny lookups, subs, marking, context, will prevent the font from compiling

John Hudson's picture

Typograph, that isn't what I meant by 'multiple lookup subtables'. I mean that lookups have a maximum size, and hence multiple lookups might be necessary for a very large number of e.g. ligature substitutions.

I don't use FontLab for OpenType Layout work, so someone else will have to explain the syntax to separate lookups.

gargoyle's picture

In FontLab the syntax ought to look something like this:

feature liga { # Default ligatures

   lookup liga_1 { # lookup subtable 1
     sub f i by fi;
     sub f l by fl;
   } liga_1;

   lookup liga_2 { # lookup subtable 2
     sub f f i by ffi;
     sub f f l by ffl;
   } liga_2;


} liga;

With 1,200 ligatures, grouping them into separate lookups should also make them all a bit easier to manage.

dezcom's picture

What is the maximum lookups in a subtable or is that even the right parameter to determine when to break into a new subtable?


gargoyle's picture

As I understand it, the limit is 64K per lookup. The issue most often crops up with the kern feature, which can become quite large even in modest-sized fonts. You'll usually know you've hit the limit when your feature fails to compile and the error mentions something like "offset overflow." (The kern feature is easier to deal with since it supports subtable breaks, so you can divide it into subtables with simple "subtable;" statements.)

It's worth mentioning that the order of lookup subtables does matter, just as with the order of statements and features. There's actually a flaw in my example code above; the lookups should be in the opposite order. If "sub f i by fi" runs first, then "sub f f i by ffi" won't do anything since every instance of "f i" has already been substituted by "fi". (Sure, "sub f fi by ffi" would work, but feels less elegant.) Be careful to keep potential conflicts such as this in mind when organizing your code.

Syndicate content Syndicate content