3

I am trying to understand how the WordSpace factor of fontspecs's \addfontfeatures works. The word space is decreasing when I lower it, but not increasing when I increase the factor again:

\documentclass{article}
\usepackage{fontspec}
\setromanfont{Latin Modern Roman}
\begin{document}
Ein paar Wörter.

{\addfontfeatures{WordSpace=0.9,LetterSpace=0}Ein paar Wörter.}

{\addfontfeatures{WordSpace=0.7,LetterSpace=0}Ein paar Wörter.}

{\addfontfeatures{WordSpace=0.3,LetterSpace=0}Ein paar Wörter.}

{\addfontfeatures{WordSpace=0.7,LetterSpace=0}Ein paar Wörter.}

{\addfontfeatures{WordSpace=0.9,LetterSpace=0}Ein paar Wörter.}

Ein paar Wörter.
\end{document}

My application for it is to selectively squeeze some lines of verse to avoid a line break, or a paragraph in order to avoid widows and orphans, but I became aware of the fact that I cannot really control the factor and thus keep getting smaller word space. How do I increase the word space factor again?

output

EDIT: As suggested by egreg \spaceskip looks like a good way of doing this indeed. Just that I also have to take care of any \textsl and similar passages contained in the stretch of text to be adjusted, and that when reducing the inter word space quite a bit also the extra spaces after punctuation should be adjusted, via \xspaceskip.

5

Wordspace changes the current fontdimen by the factor you give. You can see the settings in the log-file:

   . \fontdimen 2\font =.2\fontdimen 2\font \fontdimen 3\font =.2\fontdimen
. 3\font \fontdimen 4\font =.2\fontdimen 4\font 

So if you want to increase it again you must use values larger then one.

As egreg wrote the settings are global. This effect is partly hidden in your example with the LetterSpace option which has the actual effect to load a new font.

\documentclass{article}
\usepackage{fontspec}
\setromanfont{Latin Modern Roman}
\begin{document}
Ein paar Wörter.

{\addfontfeatures{WordSpace=.2}Ein paar Wörter.}

Ein paar Wörter.

{\addfontfeatures{WordSpace=5}Ein paar Wörter.}
\end{document}

enter image description here

To show the effect of additional options here an example with color. As you see the wordspace of black and red font are adapted independently:

\documentclass{article}
\usepackage{fontspec,xcolor}
\setromanfont{Latin Modern Roman}
\begin{document}
Ein paar Wörter.

{\addfontfeatures{WordSpace=.2,Color=red}Ein paar Wörter.}

Ein paar Wörter.

{\addfontfeatures{WordSpace=5}Ein paar Wörter.}

{\addfontfeatures{WordSpace=5,Color=red}Ein paar Wörter.}
\end{document}

enter image description here

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.