# New version of fontspec gives WordSpace error

The new version of fontspec (February 1, 2016, version 2.5a) gives the following error (MacTeX2015):

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
!
! The "WordSpace" font feature cannot be used in \addfontfeatures.
!
! See the fontspec documentation for further information.
!
! For immediate help type H <return>.
!...............................................


What changed? Is there a workaround, or a better way of using fontspec.sty?

• I guess this has been done because the WordSpace feature is global and not undoable by just closing a group. Feb 3, 2016 at 15:58
• Feb 3, 2016 at 16:05
• Perhaps, but this change is nowhere mentioned in the release notes for 2.5a. In fact, the last time WordSpace was mentioned was in the release notes for version 2.4 which does not cause the error. Feb 3, 2016 at 16:05
• Apologies for the oversight with the release notes. Feb 4, 2016 at 1:09

In the new version, the code for the option is (from fontspec-keyval.dtx)

% \paragraph{Inter-word space}
% These options set the relevant \cmd\fontdimen s for the
%    \begin{macrocode}
\@@_keys_define_code:nnn {fontspec} {WordSpace}
{
\bool_if:NF \l_@@_firsttime_bool
{ \_fontspec_parse_wordspace:w #1,,,\q_stop }
}
\@@_aff_error:n {WordSpace}
%    \end{macrocode}


and it is similar to the code for HyphenChar and PunctuationSpace. The problem is that these options act globally on a font and cannot be undone by simply closing a group. See WordSpace factor does not increase again for an example.

For completeness, here's the code for aff_error:

% For catching features that cannot be used in |\addfontfeatures|:
%    \begin{macrocode}
\cs_new:Nn \@@_aff_error:n
{
}
%    \end{macrocode}


If you want different interword space in some part of your document, you are better to define a specific font family:

\documentclass{article}
\usepackage{fontspec}

\setmainfont{Linux Libertine O}

\newfontfamily{\morespace}{Linux Libertine O}[
WordSpace={2, 2, 2}
]

\begin{document}

Some text. Some text.

{\morespace Some text. Some text.}

Some text. Some text.

\end{document}


Of course, the change should be mentioned in the documentation.

• Thanks egreg. If you really wanted to work around the new restriction, I guess it would work to write \ExplSyntaxOn\__fontspec_keys_define_code:nnn {fontspec-addfeatures} {WordSpace} {}\ExplSyntaxOff after loading fontspec. Feb 4, 2016 at 1:16
• Thanks for the pointer, but probably better to do the right thing in the first place, as you did. I cleaned up a lot of code this afternoon. Harumph. Feb 4, 2016 at 1:54