8

For the following case,

% !TeX program = xelatex
\documentclass[12pt]{article}
\usepackage{fontspec}

\begin{document}
  \hsize =2in
  shelf{}ful shelf{}ful shelf\-ful di\discretionary{f-}{fi}{f\kern0ptfi}cult
\end{document}

I get,

enter image description here

Actually, if there's a kern followed by anything in the third argument of \discretionary, letters after it disappear, but when I don't use the package fontspec, nothing goes wrong. Is this a bug?

  • It's not fontspec. If I do the same with xetex, the problem shows as well. – egreg Jan 24 '17 at 15:44
  • Neat. But it is not a fontspec problem. You see the same problem if you don't load fontspec and call the font as \font\test="[lmroman12-regular.otf]"\test – Ulrike Fischer Jan 24 '17 at 15:44
  • raised as sourceforge.net/p/xetex/bugs/137 – David Carlisle Jan 24 '17 at 20:40
5

This seems a bug in XeTeX. If there's something which is not a letter in the “nobreak” argument to \discretionary and a break is taken, the word part following the discretionary disappears.

Minimal example:

\input ifxetex.sty

\ifxetex
  \font\test="Latin Modern Roman:mapping=tex-text" at 12pt
\else
  \font\test=ec-lmr12
\fi
\test

\hsize =2in \advance\hsize by 11pt

shelf{}ful shelf{}ful shelf\-ful di\discretionary{f-}{fi}{f\kern0ptfi}cult task

shelf{}ful shelf{}ful shelf\-ful di\discretionary{f-}{fi}{f\/fi}cult task

shelf{}ful shelf{}ful shelf\-ful di\discretionary{f-}{fi}{f{}fi}cult task

shelf{}ful shelf{}ful shelf\-ful di\discretionary{f-}{fi}{ffi}cult task

di\discretionary{f-}{fi}{ffi}cult task

\bye

Compile with xetex and the result is

enter image description here

If compiled with pdftex we get the expected result:

enter image description here

  • 1
    The problem appears only if the \kern or {} is between two letters in the “nobreak” argument. Note also that {} doesn't break ligatures when an OpenType/TrueType font is used. – egreg Jan 24 '17 at 16:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.