[luatex] fontspec prevents German hyphenation

Manuel Pégourié-Gonnard mpg at elzevir.fr
Mon Aug 2 12:29:48 CEST 2010


Le 02/08/2010 12:01, Manuel Pégourié-Gonnard a écrit :
> So, clearly fontspec (or most probably luaotfload) has something to do with this
> problem. Maybe it introduces some new nodes or whatever. Khaled, any idea?
> 
More precisely, it seems to be related to italic correction (automatically
inserted by LaTeX commands when switching to/from italic). First, let's try yet
another example:

\documentclass{article}
\usepackage{fontspec}
\newcommand\boxshow[1]{\setbox0=\hbox{#1}\showbox0}
\showboxdepth8 \showboxbreadth1024
\begin{document} {\itshape} % just preload italic font
\boxshow{(document)}
\boxshow{(\textit{document})}
\boxshow{({\itshape document})}
\end{document}

>From the log:

> \box0=
\hbox(7.5+2.5)x50.56, direction TLT
.\EU2/lmr/m/n/10 (
.\EU2/lmr/m/n/10 d
.\EU2/lmr/m/n/10 o
.\kern 0.28
.\EU2/lmr/m/n/10 c
.\discretionary
..\EU2/lmr/m/n/10 -
.\EU2/lmr/m/n/10 u
.\discretionary
..\EU2/lmr/m/n/10 -
.\EU2/lmr/m/n/10 m
.\EU2/lmr/m/n/10 e
.\EU2/lmr/m/n/10 n
.\kern -0.28
.\EU2/lmr/m/n/10 t
.\EU2/lmr/m/n/10 )


! OK.
l.6 \boxshow{(document)}

?
> \box0=
\hbox(7.5+2.5)x49.18001, direction TLT
.\EU2/lmr/m/n/10 (
.\kern 0.0
.\EU2/lmr/m/it/10 d
.\EU2/lmr/m/it/10 o
.\kern -0.51
.\EU2/lmr/m/it/10 c
.\EU2/lmr/m/it/10 u
.\EU2/lmr/m/it/10 m
.\EU2/lmr/m/it/10 e
.\EU2/lmr/m/it/10 n
.\EU2/lmr/m/it/10 t
.\kern 0.0
.\EU2/lmr/m/n/10 )

! OK.
l.7 \boxshow{(\textit{document})}

Notice the two \kern 0.0

> \box0=
\hbox(7.5+2.5)x49.18001, direction TLT
.\EU2/lmr/m/n/10 (
.\EU2/lmr/m/it/10 d
.\EU2/lmr/m/it/10 o
.\kern -0.51
.\EU2/lmr/m/it/10 c
.\discretionary
..\EU2/lmr/m/it/10 -
.\EU2/lmr/m/it/10 u
.\discretionary
..\EU2/lmr/m/it/10 -
.\EU2/lmr/m/it/10 m
.\EU2/lmr/m/it/10 e
.\EU2/lmr/m/it/10 n
.\EU2/lmr/m/it/10 t
.\EU2/lmr/m/n/10 )

! OK.
l.8 \boxshow{({\itshape document})}

The lower-level command \itshape just switches to italic without inserting \/
and doesn't break hyphenation.

Now, try the same example without fontspec. Here is only the second box (the one
with \textit):

> \box0=
\hbox(7.5+2.5)x50.12613, direction TLT
.\OT1/cmr/m/n/10 (
.\OT1/cmr/m/it/10 d
.\OT1/cmr/m/it/10 o
.\kern-0.51112
.\OT1/cmr/m/it/10 c
.\discretionary
..\OT1/cmr/m/it/10 -
.\OT1/cmr/m/it/10 u
.\discretionary
..\OT1/cmr/m/it/10 -
.\OT1/cmr/m/it/10 m
.\OT1/cmr/m/it/10 e
.\OT1/cmr/m/it/10 n
.\OT1/cmr/m/it/10 t
.\kern 0.94861
.\OT1/cmr/m/n/10 )

! OK.
l.7 \boxshow{(\textit{document})}

Interestingly enough, the initial \kern was omitted, and the last \kern is not
null (I know cmr and lmr aren't supposed to have exactly the same metrics, but
I'm still surprised the italic correction is null for one and non-null for the
other).

Manuel.


More information about the luatex mailing list