[tex-live] Ignored italic correction with lua(la)tex format

Philipp Stephani p.stephani2 at googlemail.com
Sat Oct 8 09:27:11 CEST 2011

2011/10/7 Dan Luecking <luecking at uark.edu>:
> On Thu Oct 6, 2011 at 23:31:38 CEST, Philipp Stephani wrote
>> 2011/10/6 Khaled Hosny
>> <<http://tug.org/mailman/listinfo/tex-live>khaledhosny at eglug.org>:
>> > Hi all,
>> >
>> > After a long night of debugging and hair pulling, I finally found why
>> > italic correction for OpenType math fonts is ignored in luatex and
>> > lualatex formats but not in context.
>> >
>> > For some reason not yet clear to me, the setting of catcode to 11 in
>> > luatex-unicode-letters.tex causes luatex to not apply italic correction
>> > (might be related to the fact that luatex applies IC selectively).
>> >
>> > This minimal example shows the issues:
>> >
>> > \input luaotfload.sty
>> > \font\xits={file:xits-math.otf} at 10pt
>> > \textfont0=\xits
>> > $$\Umathchar"7"0"1D443\Umathchar"4"0`($$
>> > \bye
>> >
>> > after commenting the \catcode part in line 18 of
>> > luatex-unicode-letters.tex and rebuilding the format, italic correction
>> > is applied.
>> >
>> > I'm not sure what is the proper fix here, though.
>> LuaTeX explicitly removes italic correction after letters:
>>            if (is_new_mathfont(cur_f) && get_char_cat_code(cur_c) == 11) {
>>                *delta = 0;     /* no italic correction in mid-word of
>> text font */
>>            }
>> This seems like a bug to me.
> The comment seen above (no italic correction in mid-word)
> is how TeX is supposed to behave in math *unless*
> \fontdimen2 of the font is 0.

This is the traditional approach that LuaTeX uses for non-Unicode
fonts. I've left this out in the above code snippet since it's not
relevant for OpenType math.

> \fontdimen2 is the size of
> a space. Thus, sequences of symbols from cmr are not
> separated by italic correction, but symbols from cmmi
> are.

This behavior cannot be transferred to OpenType math since with
OpenType math, all characters belong to the same family.

> On the other hand, at the *end* of a "word" (i.e.,
> where the next symbol is from another math family) an
> italic correction is still appropriate. Perhaps in the
> example given, the "P" and the "(" are from the same
> family?

Yes. This is always/usually the case with OpenType math.

> Caveats: This assumes that I correctly understand the concerns
> of the OP, that my reading of the TeXbook is correct and that
> luaotfload is trying to emulate original TeX as far as possible.

It's in fact not related to luaotfload, but to the engine itself
(therefore I'm CCing the LuaTeX list). Since in OpenType math
typesetting, all characters in a math list are from the same font and
belong to the same family, the TeX method doesn't work any more and
LuaTeX necessarily has to be incompatible. The OpenType math
documentation specifies that italic correction can be applied between
a run of italic characters and an upright character, but there is no
simple way to find out whether a character is italic.

More information about the tex-live mailing list