4

When using the libertinus font and compiling with xelatex, selecting the sans italic font with \textit causes the bold italic font to be loaded. Why?

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Libertinus Sans}

\begin{document}
Test

\textbf{Test}

\textit{Test}
\end{document}

enter image description here

There is a font called Libertinus Sans Italic in the libertinus folder, and it seems to be found according to the .log file:

.................................................
. fontspec info: "defining-font"
. 
. Font family 'LibertinusSans(0)' created for font 'Libertinus Sans' with
. options [Ligatures=TeX].
.  
.  This font family consists of the following NFSS series/shapes:
.  
. - 'normal' (m/n) with NFSS spec.: <->"Libertinus
. Sans/OT:script=latn;language=DFLT;mapping=tex-text;"
. - 'small caps'  (m/sc) with NFSS spec.: <->"Libertinus
. Sans/OT:script=latn;language=DFLT;+smcp;mapping=tex-text;"
. - 'bold' (bx/n) with NFSS spec.: <->"Libertinus
. Sans/B/OT:script=latn;language=DFLT;mapping=tex-text;"
. - 'bold small caps'  (bx/sc) with NFSS spec.: <->"Libertinus
. Sans/B/OT:script=latn;language=DFLT;+smcp;mapping=tex-text;"
. - 'italic' (m/it) with NFSS spec.: <->"Libertinus
. Sans/I/OT:script=latn;language=DFLT;mapping=tex-text;"
. - 'italic small caps'  (m/itsc) with NFSS spec.: <->"Libertinus
. Sans/I/OT:script=latn;language=DFLT;+smcp;mapping=tex-text;"
. - 'bold italic' (bx/it) with NFSS spec.: <->"Libertinus
. Sans/BI/OT:script=latn;language=DFLT;mapping=tex-text;"
. - 'bold italic small caps'  (bx/itsc) with NFSS spec.: <->"Libertinus
. Sans/BI/OT:script=latn;language=DFLT;+smcp;mapping=tex-text;"
.................................................
3

This seems to be a bug in Libertinus Sans BoldItalic: The bold italic font is only italic according to the OpenType style field, so XeTeX picks it up as the regular italic font. You can overwrite this decision by using

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Libertinus Sans}[
  ItalicFont={Libertinus Sans Italic}
]

\begin{document}
Test

\textbf{Test}

\textit{Test}
\end{document}

Alternativly you can switch to LuaTeX: The LuaTeX fontloader ignores the relevant OpenType values anyway, so the problem does not appear there.

  • I've reported the bug: github.com/libertinus-fonts/libertinus/issues/210 – Sverre Aug 21 '18 at 19:53
  • 1
    @Sverre That is not the right Bug Tracker: There is no Sans BoldItalic in the libertinus-fonts. It is an addition from the [ctan.org/pkg/libertinus-otf](libertinus-otf) package. – Marcel Krüger Aug 21 '18 at 20:06
  • @MarcelKrüger: which "style field" do you mean? – user2478 Aug 22 '18 at 13:40
  • @Herbert The macStyle in the head table is (in binary) 10, but it should be 11 because bit 0 represents bold and BoldItalic is bold. Also bit 5 in the fsSelection field of the OS/2 table should be set (It is an alias for bit 0 from macStyle) and also in OS/2 the field usWeightClass should be 700 (bold) instead of 400 (regular). I am not quite sure which of these field XeTeX uses but I would guess it is the macStyle. – Marcel Krüger Aug 22 '18 at 14:16
1
\documentclass{article}
\usepackage[usefilenames]{libertinus-otf}
\renewcommand\familydefault{\sfdefault}
\begin{document}
    Test

    \textbf{Test}

    \textit{Test}
\end{document}

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.