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

Dan Luecking luecking at uark.edu
Fri Oct 7 19:31:08 CEST 2011


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. \fontdimen2 is the size of
a space. Thus, sequences of symbols from cmr are not
separated by italic correction, but symbols from cmmi
are.

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?

However, category codes are *not* supposed to be used
(in regular TeX) in making this decision. If two adjacent
symbols are from the same family and if also \fontdimen2
is not 0, then no italic correction is used, but ligature
and kerning information are used.

Also, these decisions are made after the math list was
prepared, so TeX only knows about math "items" (types Ord,
Punct, Bin, Choice, etc.) and whether the nucleus is a
single symbol or a further math list. In this context,
categories are meaningless: there are no unexpanded macros,
no unexecuted commands, no grouping characters, no space
charaters, no comments, no unprocesses superscripts, etc.

Finally, if these italic corrections are simply being removed
from the metrics of the font, that should always be wrong.

Responding to another claim in this thread, hyphenation is
also not associated with \catcode, only \lccode. It happens
after a horizontal list was already prepared and this also is
a context where category codes are meaningless.

The "letters" in \patterns{} and \hyphenation{} commands can
have category 11 or 12, but must have nonzero \lccode.

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.


Dan


Daniel H. Luecking
Department of Mathematical Sciences
Fayetteville, Arkansas
http://www-cs-faculty.stanford.edu/~knuth/iaq.html 



More information about the tex-live mailing list