\AddFontFeature in plain XeTeX

XeLaTeX package “fontspec” provides an useful command “AddFontFeature” to add an effect to the curently selected font. Unfortunately, it works only if fontspec is used. Otherwise, a workaround is required. So far here is a draft to make text narrow:

Somewhere in .tex-file define the command:

\newcommand\ForceNarrowText{%
\def\addtoname"##1"{\def\NarrowFontName{"##1:extend=0.8"}}%
\expandafter\addtoname\fontname\font%
%\show\NarrowFontName
\font\NarrowFont=\NarrowFontName\relax \NarrowFont}

and then use it:

hello {\ForceNarrowText hello} hello

Leave a Reply