[Tex/LaTex] Linux Libertine, libertineotf package and bold

boldfontslibertinepdftexxetex

Being interested by using the Linux Libertine font, I made some test with XeLaTeX and pdfLaTeX. My idea was to find a font that is suitable for use in xelatex, pdflatex and outside of any TeX flavour.

I was surprised to see that bold typefaces were heavier in pdflatex (with the package libertine) than in xelatex (using the \setmainfont command).

Then I tried the following code with xelatex :

\documentclass{report}
\usepackage{fontspec}
\setmainfont{Linux Libertine O}
%\usepackage{libertineotf}
\begin{document}
\chapter{Test}
This is a text (or so it seems).
\textbf{This is a bold text}
\end{document}

By commenting either the \setmainfont or the \usepackage{libertineotf} line, I noticed that the bold (chapter title for instance) where heavier when using the package. The same difference shows when using the libertine package (libertine, not libertineotf) with pdflatex.

Does anyone know if there a reason for that? Is there a way to have both giving the same result?

Thanks

Best Answer

Well libertineotf declares which font to use for bold:

 \setmainfont[Extension=.otf,
        BoldFont=LinLibertine_RB,
        ....

And this can be a different font to the one found if you use only \setmainfont.

You can add \XeTeXtracingfonts= 1 to your document to get some more informations in the log-file. And you can compile with xelatex --output-driver="xdvipdfxm -vv" to see on the terminal which fonts are included.