\setmainfont 不会改变粗体字体大小

\setmainfont 不会改变粗体字体大小

我想排版一份 Times New Roman 18pt 大小的文档(使用 xelatex)。MWE:

\documentclass{article}
\usepackage[a4paper]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{fontspec}
\setmainfont[SizeFeatures={Size=18}]{Times New Roman}
\newcommand\test{The quick brown fox jumps over the lazy dog.}
\begin{document}
\begin{itemize}
    \item \textbf{Header 1}: \test
    \item \textbf{Header 2}: \test
    \item \textbf{Header 3}: \test
\end{itemize}
\end{document}

我明白了:

enter image description here

不幸的是,粗体标题没有改变。如何修复?

答案1

您需要SizeFeatures分别指定粗体和斜体变体。

在旁边:你不需要\usepackage[utf8]{inputenc}with xelatex。基于 utf8 的引擎会忽略它。

\documentclass{article}
\usepackage[a4paper]{geometry}
\usepackage{fontspec}
\setmainfont{Times New Roman}[%
  UprightFeatures={SizeFeatures={Size=18}},
  ItalicFeatures={SizeFeatures={Size=18}},
  BoldFeatures={SizeFeatures={Size=18}},
  BoldItalicFeatures={SizeFeatures={Size=18}},
]
\newcommand\test{The quick brown fox jumps over the lazy dog.}
\begin{document}
\begin{itemize}
    \item \emph{Header 1}: \test
    \item \textbf{Header 2}: \test
    \item \textbf{\emph{Header 3}}: \test
\end{itemize}
\end{document}

enter image description here

相关内容