12

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

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
./mathcal2016.tex:17: fontspec error: "not-in-addfontfeatures"
! 
! 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. – egreg Feb 3 '16 at 15:58
  • See WordSpace factor does not increase again – egreg Feb 3 '16 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. – sgmoye Feb 3 '16 at 16:05
  • 1
    github.com/wspr/fontspec/issues/224 – egreg Feb 3 '16 at 16:31
  • 1
    Apologies for the oversight with the release notes. – Will Robertson Feb 4 '16 at 1:09
13

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
% font being loaded.
%    \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
  {
    \@@_keys_define_code:nnn {fontspec-addfeatures} {#1}
      { \@@_error:nx {not-in-addfontfeatures} {#1} }
  }
%    \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}

enter image description here

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

  • 2
    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. – Will Robertson Feb 4 '16 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. – sgmoye Feb 4 '16 at 1:54

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.