4

I have problems when I use small italic capitals with a "non-standard" font weight (here semi-bold).

I tried several things like FontFace={sb}{it}{Font=LinLibertine_RZI_G. ttf, SmallCapsFont={LinLibertine_RZI_G. ttf}, SmallCapsFeatures={RawFeature={+smcp}}}}, but it doesn’t work. I don’t know how to ask Fontspec to use the small semi-bold italic capitals.

Do you have any suggestions?

\documentclass{article}

\usepackage{fontspec}

\setmainfont{Linux Libertine G}[ FontFace = {sb}{n}{LinLibertine_RZ_G.ttf} , FontFace = {sb}{it}{LinLibertine_RZI_G.ttf}, ]

\DeclareOldFontCommand{\sbseries}{\fontseries{sb}\selectfont}{\mathbf} \DeclareTextFontCommand{\textsb}{\sbseries}

\begin{document}

Hello world. \textsb{Hello world.} \textbf{Hello world.}

\textit{Hello world.} \textit{\textsb{Hello world.}} \textit{\textbf{Hello world.}}

\textsc{Hello world.} \textsb{\textsc{Hello world.}} \textbf{\textsc{Hello world.}}

\textit{\textsc{Hello world.}} \textit{\textsb{\textsc{Hello world.}}} \textit{\textbf{\textsc{Hello world.}}}

\end{document}

enter image description here

EDIT

After Egreg’s answer, here’s my new MWE, But the problem remains :

\documentclass{article}

\usepackage{fontspec}

\setmainfont{Linux Libertine G}[ BoldFont=LinLibertine_RB_G.ttf, BoldItalicFont=LinLibertine_RBI_G.ttf, FontFace={sb}{n}{LinLibertine_RZ_G.ttf}, FontFace={sb}{it}{LinLibertine_RZI_G.ttf}, ]

\DeclareRobustCommand{\sbseries}{\fontseries{sb}\selectfont} \DeclareTextFontCommand{\textsb}{\sbseries}

\begin{document} \textit{\textsc{Hello world.}} \textit{\textsb{\textsc{Hello world.}}} \textit{\textbf{\textsc{Hello world.}}} \end{document}

Bastien
  • 449
  • 1
    It's not clear to me what you're trying to achieve. E.g., are you looking to use semibold rather than (outright) bold as the default font weight for "bold", or do you wish to employ both semibold and bold? Please advise. – Mico Apr 11 '21 at 08:52
  • Did you try with \DeclareRobustCommand{\sbseries}{\fontseries{sb}\selectfont}? – egreg Apr 11 '21 at 08:55
  • 1
    Hello @Mico, indeed, I use in my document the bold and semi-bold, so I wish I could use the small italic capitals in bold and semi-bold. – Bastien Apr 11 '21 at 08:56
  • Hello @egreg, I just tried but it doesn’t seem to work. – Bastien Apr 11 '21 at 08:58
  • @Bastien Yes, it does, but you also need to declare the bold font. – egreg Apr 11 '21 at 09:12
  • 1
    I don't have the Linux Libertine G fonts. If they're at all similar to the Linux Libertine O fonts, you may need to re-think the wisdom of using both the semibold and the bold font weights in one and the same document, as the two font weights are sufficiently similar as to make it difficult (or even impossible) for most readers to be able to tell whether a given word is rendered in semibold or bold. – Mico Apr 11 '21 at 09:17
  • The problem is that LinLibertine_RZI_G.ttf does not have small caps. You can check this with otfinfo -f. – Davislor Apr 11 '21 at 13:10
  • That’s the Graphite version of the font. Linux Libertine O, the OpenType version, does support semibold italic small caps. – Davislor Apr 11 '21 at 13:14

1 Answers1

5

Why shouldn't old font commands such as \rm or \it or \bf used? Because they follow the original LaTeX setup and reset all font features. So if you do \it\bf you just get boldface and not italic.

The command \DeclareOldFontCommand should only be used for compatibility with older documents. If you look in the LaTeX kernel, you'll see that \bfseries is defined with \DeclareRobustCommand.

You have also to declare what bold font you plan to use, if you define semibold.

\documentclass{article}

\usepackage{fontspec}

\setmainfont{Linux Libertine O}[ BoldFont=* Bold, BoldItalicFont=* Bold Italic, FontFace = {sb}{n}{* Semibold}, FontFace = {sb}{it}{* Semibold Italic}, ]

\DeclareRobustCommand{\sbseries}{\fontseries{sb}\selectfont} \DeclareTextFontCommand{\textsb}{\sbseries}

\begin{document}

Hello world. \textsb{Hello world.} \textbf{Hello world.}

\textit{Hello world.} \textit{\textsb{Hello world.}} \textit{\textbf{Hello world.}}

\textsc{Hello world.} \textsb{\textsc{Hello world.}} \textbf{\textsc{Hello world.}}

\textit{\textsc{Hello world.}} \textit{\textsb{\textsc{Hello world.}}} \textit{\textbf{\textsc{Hello world.}}}

\end{document}

The fonts have been changed to suit my machine.

enter image description here

If I replace all periods with .\typeout{\fontname\font}, the terminal shows

"Linux Libertine O/OT:script=latn;language=dflt;mapping=tex-text;"
"Linux Libertine O Semibold/OT:script=latn;language=dflt;mapping=tex-text;"
"Linux Libertine O Bold/OT:script=latn;language=dflt;mapping=tex-text;"
"Linux Libertine O Italic/OT:script=latn;language=dflt;mapping=tex-text;"
"Linux Libertine O Semibold Italic/OT:script=latn;language=dflt;mapping=tex-text;"
"Linux Libertine O Bold Italic/OT:script=latn;language=dflt;mapping=tex-text;"
"Linux Libertine O/OT:script=latn;language=dflt;+smcp;mapping=tex-text;"
"Linux Libertine O Semibold/OT:script=latn;language=dflt;+smcp;mapping=tex-text;"
"Linux Libertine O Bold/OT:script=latn;language=dflt;+smcp;mapping=tex-text;"
"Linux Libertine O Italic/OT:script=latn;language=dflt;+smcp;mapping=tex-text;"
"Linux Libertine O Semibold Italic/OT:script=latn;language=dflt;+smcp;mapping=tex-text;"
"Linux Libertine O Bold Italic/OT:script=latn;language=dflt;+smcp;mapping=tex-text;"

which seems to be what you're looking for.

Here's the setup for Libertinus Serif.

\documentclass{article}

\usepackage{fontspec}

\setmainfont{LibertinusSerif}[ Extension=.otf, UprightFont=-Regular, ItalicFont=-Italic, BoldFont=-Bold, BoldItalicFont=-BoldItalic, FontFace = {sb}{n}{-Semibold}, FontFace = {sb}{it}{-SemiboldItalic}, ]

\DeclareRobustCommand{\sbseries}{\fontseries{sb}\selectfont} \DeclareTextFontCommand{\textsb}{\sbseries}

\begin{document}

Hello world\typeout{\fontname\font}. \textsb{Hello world\typeout{\fontname\font}.} \textbf{Hello world\typeout{\fontname\font}.}

\textit{Hello world\typeout{\fontname\font}.} \textit{\textsb{Hello world\typeout{\fontname\font}.}} \textit{\textbf{Hello world\typeout{\fontname\font}.}}

\textsc{Hello world\typeout{\fontname\font}.} \textsb{\textsc{Hello world\typeout{\fontname\font}.}} \textbf{\textsc{Hello world\typeout{\fontname\font}.}}

\textit{\textsc{Hello world\typeout{\fontname\font}.}} \textit{\textsb{\textsc{Hello world\typeout{\fontname\font}.}}} \textit{\textbf{\textsc{Hello world\typeout{\fontname\font}.}}}

\end{document}

enter image description here

Just to check what fonts are being used, I added \typeout{\fontname\font} and on the terminal I get

"[LibertinusSerif-Regular.otf]/OT:script=latn;language=dflt;mapping=tex-text;"
"[LibertinusSerif-Semibold.otf]/OT:script=latn;language=dflt;mapping=tex-text;"
"[LibertinusSerif-Bold.otf]/OT:script=latn;language=dflt;mapping=tex-text;"
"[LibertinusSerif-Italic.otf]/OT:script=latn;language=dflt;mapping=tex-text;"
"[LibertinusSerif-SemiboldItalic.otf]/OT:script=latn;language=dflt;mapping=tex-text;"
"[LibertinusSerif-BoldItalic.otf]/OT:script=latn;language=dflt;mapping=tex-text;"
"[LibertinusSerif-Regular.otf]/OT:script=latn;language=dflt;+smcp;mapping=tex-text;"
"[LibertinusSerif-Semibold.otf]/OT:script=latn;language=dflt;+smcp;mapping=tex-text;"
"[LibertinusSerif-Bold.otf]/OT:script=latn;language=dflt;+smcp;mapping=tex-text;"
"[LibertinusSerif-Italic.otf]/OT:script=latn;language=dflt;+smcp;mapping=tex-text;"
"[LibertinusSerif-SemiboldItalic.otf]/OT:script=latn;language=dflt;+smcp;mapping=tex-text;"
"[LibertinusSerif-BoldItalic.otf]/OT:script=latn;language=dflt;+smcp;mapping=tex-text;"

After seeing the output, both in the Linux Libertine and Libertinus serif cases, I believe that using both bold and semibold does not work, because the weights are not distinguishable enough: only if they're next to each other one can spot some difference. You should choose one of them as the boldface font and don't rely on both.

egreg
  • 1,121,712
  • 1
    thank you for your answer, I adapted your preamble to the font I have but the problem persists. So maybe I’ll use Linux Libertine O instead of Linux Libertine G if the problem comes from the font. – Bastien Apr 11 '21 at 09:36
  • 2
    @Bastien I'd go for Libertinus, which is maintained and developed. – egreg Apr 11 '21 at 09:59
  • 2
    @Bastien I added the setup for Libertinus and also a final comment. – egreg Apr 11 '21 at 10:41