[XeTeX] Bad handling of lookup subtables.

Paul Isambert zappathustra at free.fr
Tue Feb 21 12:02:02 CET 2012

Hello all,

I use XeTeX to do some testing on fonts. If I'm not mistaken, given a
lookup with subtables, the latter are tried one after the other until
one of them identifies a proper input and is applied. In other words,
only one subtable should be applied for a given lookup.

However, it seems to me that XeTeX applies all subtables; in most cases,
this is harmless, since only one of them finds a proper input anyway.
But in some cases, a subtable may be designed precisely to prevent a
subsequent subtable from matching in some contexts.

For instance, this is how the "ss02" feature in Minion Pro works (Minion
Pro is distributed with Acrobat, which is why I use it as an example).
This feature replaces some letter, e.g. "e", by variants ("e.end") in
some contexts (at the end of a word). To do so, a first subtable matches
"e + X", where "X" is another letter, and does nothing; a second subtable
matches "e" anywhere and does the replacement. The net effect is that
"e" is replaced with "e.end" only when not followed by another letter,
since the first subtable prevents the second from matching in unwanted

However, since XeTeX applies all subtables, the replacement is always
done. I've also tested that with a stupid handmade substitution turning
"a" to "b" (first subtable) and "b" to "c" (second subtable), just to
make sure XeTeX wasn't confused by dummy subtables (i.e. performing no
change) and/or contextual substitutions; the test was positive as I
ended up with "a" turned to "c" instead of "b".

As far as I'm concerned, this is a pretty serious bug; but perhaps I've
missed something (including, who knows, that this bug has already been


More information about the XeTeX mailing list