Weird behavior when using small caps and slanted fonts with fontspec in XeLaTeX

I use XeLaTeX and the fontspec package.

Now, I like to use Linux Libertine as standard font. The slanted (not italics) characters are stored in a different font. Now, to use them with \slshape, I have to select them explicitly:

\setmainfont[
SlantedFont={Linux Libertine Slanted O},
SmallCapsFeatures={Letters=SmallCaps},
Mapping=tex-text, Numbers=OldStyle, Variant=01, Ligatures={TeX, Common}, Contextuals=WordFinal,
% Style=Alternate, Ligatures={Rare, TeX, Common}
]{Linux Libertine O}


As you can see, the slanted font is selected in the SlantedFont={Linux Libertine Slanted O} argument.

When I use \slshape in my document now:

{\slshape \lipsum[1-2]}


It creates the correct slanted text.

(\usepackage{lipsum} is further up in the file.)

Now, when I want to use small caps I use \scshape:

{\scshape \lipsum[3-4]}


The text is slanted small caps! To circumvent this, I have to comment out the SlantedFont argument in \setmainfont, this makes the small caps upright, but I lose slanted text capabilities.

How do I make both behave corectly?

• Declare also SmallCapsFont={Linux Libertine O} – egreg Jan 23 '12 at 18:37

adding ItalicFeatures gets you part of the way there...my eyes aren't good enough to tell the difference....

\setmainfont[
ItalicFont={Linux Libertine O}, ItalicFeatures={SmallCapsFont={Linux Libertine O Italic}},
SlantedFont={Linux Libertine Slanted O},
SmallCapsFont={Linux Libertine O},
SmallCapsFeatures={Letters=SmallCaps},
Mapping=tex-text, Numbers=OldStyle, Ligatures={TeX, Common}, Contextuals=WordFinal,
]{Linux Libertine O}

{\slshape Abc}

{\scshape Def}

{\scshape\itshape Ghi}

{\scshape\slshape Lmn}%


an image similar to above....GHI and Lmn are the same...but slanted or italic

• It's kinda what I came across. – polemon Feb 18 '13 at 4:38

In this particular case it's sufficient to omit the SmallCapsFeatures key:

\documentclass{article}
\usepackage{fontspec}
\setmainfont[
SlantedFont={Linux Libertine Slanted O},
SmallCapsFont={Linux Libertine O},
SmallCapsFeatures={Letters=SmallCaps},
Mapping=tex-text, Numbers=OldStyle, Ligatures={TeX, Common}, Contextuals=WordFinal,
]{Linux Libertine O}
\begin{document}
{\slshape Abc}

{\scshape Def}

{\scshape\itshape Ghi}

{\scshape\slshape Lmn}

\end{document}


• Erm, that's not what I wanted. I want upright small caps. Small caps should only be slanted if used with \slshape. You have {\scshape Def} and the result is slanted as well, which in my case is incorrect. – polemon Jan 23 '12 at 19:20
• @polemon This is something Will should look into. – egreg Jan 23 '12 at 20:22
• While this solution works partially, I lose the option to make slanted small caps: {\scshape \slshape blah} or {\scshape \itshape blah} or variants with \scshape as second argument don't work anymore. – polemon Jan 24 '12 at 2:02
• That's why I said that Will should have to look into this issue. – egreg Jan 24 '12 at 7:28