[XeTeX] Fontspec slanted features override upright features for smallcaps

Rik amphiboly at gmail.com
Mon Jul 4 02:12:12 CEST 2011


Features associated by `fontspec` with slanted fonts modify smallcap 
upright fonts. To demonstrate this, we mark font shapes with different 
colors using `SlantedFeatures` and `ItalicFeatures`. Upright forms 
remain default black.

When a font does not have slanted variants, italic shapes are used when 
slanted shapes are requested. For fonts without slanted shapes (such as 
Junicode), the upright smallcaps examples below are black as expected. 
For fonts with slanted shapes (as Latin Modern, or Junicode when an 
explicit slanted font is specified), however, the upright smallcaps 
examples are red.

(Tested with MiKTeX 2.9 current as of 2011-07-03. In particular, XeTeX
is version 0.9997.5, and fontspec is version 2.1f.)

================= (not quite) MWE ============================
\documentclass{minimal}

% Temporary fix from Joseph Wright
% needed until MiKTeX 2.9 repositories are updated with new l3 code
      \usepackage{expl3}
      \ExplSyntaxOn
      \cs_set:Npn \bool_until_do:nn #1#2
        {
          \bool_if:nF {#1}
            {
              #2
              \bool_until_do:nn {#1} {#2}
            }
        }
      \ExplSyntaxOff
% end temporary fix

  \usepackage{fontspec}

  \newfontfamily{\Junicode}[UprightFont={Junicode-Regular},
%  SlantedFont={Junicode-Italic},
      SmallCapsFont={Junicode-Regular},SmallCapsFeatures={RawFeature=+smcp},
      ItalicFeatures={Color=0000FF},
      SlantedFeatures={Color=FF0000}]{Junicode}

  \newfontfamily{\LMR}[SmallCapsFont={Latin Modern Roman Caps},
      SlantedFont={Latin Modern Roman Slanted},
      SlantedFeatures={Color=FF0000},
      ItalicFeatures={Color=0000FF},]{Latin Modern Roman}

  \newcommand*{\Item}{\makebox[7em][l]{Equaling}}

  \newcommand*{\Row}{\Item\textit{\Item}\textsl{\Item}\textsc{\Item}}

  \newcommand{\Tbl}{\makebox[2em][r]{\texttt{UP:}~}\Row\\
      {\makebox[2em][r]{\texttt{TT:}~}\itshape\Row}\\
      {\makebox[2em][r]{\texttt{SL:}~}\slshape\Row}\\
      {\makebox[2em][r]{\texttt{SC:}~}\scshape\Row}}

  \newcommand{\Hdg}{\texttt{\makebox[2em]{}%
             \makebox[7em][l]{Base}\makebox[7em][l]{Italic}%
             \makebox[7em][l]{Slanted}\makebox[7em][l]{SmallCap}}}

  \newcommand{\Test}[2]{%
             {\noindent\\\csname #1 
\endcsname\textbf{#2}\\\Hdg\\\noindent\Tbl}}

\begin{document}

Features associated by \verb!fontspec! with slanted fonts modify 
smallcap upright fonts. To demonstrate this, we mark font shapes with 
different colors using \verb!SlantedFeatures! and \verb!ItalicFeatures!. 
Upright forms remain default black.

When a font does not have slanted variants, italic shapes are used when 
slanted shapes are requested. For fonts without slanted shapes (such as 
Junicode), the upright smallcaps examples below are black as expected. 
For fonts with slanted shapes (as Latin Modern, or Junicode when an 
explicit slanted font is specified), however, the upright smallcaps 
examples are red.

See in particular column \verb!Slanted! row \verb!UP!, and column 
\verb!Base! row \verb!SC!, and column \verb!SmallCap! (all rows) in the 
samples below.

(Tested with MiKTeX 2.9 current as of 2011-07-03. In particular, XeTeX
is version 0.9997.5, and fontspec is version 2.1f.)

\Test{Junicode}{Junicode}

\Test{LMR}{Latin Modern}
\end{document}
=================== MWE end ==================================



More information about the XeTeX mailing list