[XeTeX] showhyphens and fontspec

Jonathan Kew jonathan_kew at sil.org
Thu Sep 21 19:31:24 CEST 2006

On 21 Sep 2006, at 2:41 pm, Pablo Rodríguez wrote:

> For some reason unknown to me, \showhyphens is not able to display
> hyphens when \setromanfont is selected.
> \documentclass{article}
> \usepackage[spanish]{babel}
> \usepackage{fontspec}
> \setromanfont{Palatino Linotype}
> \begin{document}
> \showhyphens{semana}
> \end{document}
> If you comment the fourth line out, hyphens will be displayed.
> Is it possible to solve this?

Yes; this is a known issue. The technique used by the \showhyphens  
macro from plain.tex will not display hyphen positions when used with  
"native" fonts in xetex.

It's possible to redefine the macro so that it will display the  
breaks; here's a version you could try:

\setromanfont{Times Roman}

   \setbox0=\vbox{\hsize1sp \hbadness10000 \hfuzz\maxdimen
     \everypar={} \leftskip0pt \rightskip\leftskip \pretolerance-1
     \noindent \hskip0pt #1\par
   \setbox0=\hbox to \maxdimen{\unhbox1}}
   \setbox0=\lastbox \ifvoid0 \let\next\relax \else


This works OK for individual words; if you try putting multiple words  
in a single \showhyphens, you'll see the hyphen positions but the  
word spaces will disappear. Fixing this is left as an exercise for  
the macro wizards out there. :)


More information about the XeTeX mailing list