使用 fontspec 指定粗体类型和字体

使用 fontspec 指定粗体类型和字体

当我手动指定应加载的 Linux Libertine O 字体类型时fontspec,粗体类型比我加载完全相同的字体系列作为系统字体时要粗得多。

梅威瑟:

\documentclass{article}
\usepackage{fontspec}
\setmainfont % load font from path
    [
        Path = C:/Windows/Fonts/,
        Extension = .otf,
        UprightFont = LinLibertine_R,
        BoldFont = LinLibertine_RB,
        ItalicFont = LinLibertine_RI,
        BoldItalicFont = LinLibertine_RBI,
    ]
    {libertine}
\newfontfamily\libertinesystemfont{Linux Libertine O} % load font from system font

\begin{document}
\LARGE{\textbf{A large heading in bold type}}

\textit{ABC\textbf{\underline{V\char"0306}}DE}.

\libertinesystemfont{
\LARGE{\textbf{A large heading in bold type}}

\textit{ABC\textbf{\underline{V\char"0306}}DE}.
}
\end{document}

在此处输入图片描述

查看我的.log文件,我无法发现任何可以解释为什么这些字体类型看起来不同的内容:

.................................................
. fontspec info: "defining-font"
. 
. Font family 'libertine(0)' created for font 'libertine' with options [ Path
. = C:/Windows/Fonts/, Extension = .otf, UprightFont = LinLibertine_R,
. BoldFont = LinLibertine_RB, ItalicFont = LinLibertine_RI, BoldItalicFont =
. LinLibertine_RBI, ].
. 
. This font family consists of the following shapes:

[...]

. * 'bold' with NFSS spec.:
. <->"[C:/Windows/Fonts/LinLibertine_RB.otf]/ICU:script=latn;language=DFLT;"

[...]

. * 'bold italic' with NFSS spec.:
. <->"[C:/Windows/Fonts/LinLibertine_RBI.otf]/ICU:script=latn;language=DFLT;"

[...]

. Font family 'LinuxLibertineO(0)' created for font 'Linux Libertine O' with
. options [].
. 
. This font family consists of the following shapes:

[...]

. * 'bold' with NFSS spec.:
. <->"Linux Libertine O/B/ICU:script=latn;language=DFLT;"

[...]

. * 'bold italic' with NFSS spec.:
. <->"Linux Libertine O/BI/ICU:script=latn;language=DFLT;"

答案1

事实证明,当使用 XeLaTeX(而不是 LuaLaTeX)进行编译时,fontspec调用系统字体时不会加载粗体字体,而是加载半粗体字体,尽管文件.log似乎表明已加载常规粗体(B)和粗体斜体(BI)字体,而不是半粗体(Z)和半粗体斜体(ZI)。

\documentclass{article}
\usepackage{fontspec}
\setmainfont % load font from path
    [
        Path = C:/Windows/Fonts/,
        Extension = .otf,
        UprightFont = LinLibertine_R,
        BoldFont = LinLibertine_RZ, % Linux Libertine O Regular Semibold
        ItalicFont = LinLibertine_RI,
        BoldItalicFont = LinLibertine_RZI, % Linux Libertine O Regular Semibold Italic
    ]
    {libertine}
\newfontfamily\libertinesystemfont{Linux Libertine O} % load font from system font

\begin{document}
\LARGE{\textbf{A large heading in bold type}}

\textit{ABC\textbf{\underline{V\char"0306}}DE}.

\libertinesystemfont{
\LARGE{\textbf{A large heading in bold type}}

\textit{ABC\textbf{\underline{V\char"0306}}DE}.
}
\end{document}

在此处输入图片描述

fontspec我不清楚它为什么会这样做,以及为什么在 XeLaTeX 和 LuaLaTeX 中的行为不同。

相关内容