使 \setmainfont 生效的正确方法是什么?

使 \setmainfont 生效的正确方法是什么?
\documentclass{article}
\usepackage{fontspec}

\setmainfont[BoldItalicFont={Times New Roman}]{DejaVu Sans}

\begin{document}

    1. This is normal as expected.

    \textit{2. This is in italic as expected.}
    
    \textbf{3. This is in bold as expected.}
    
    \textit{\textbf{4. This is NOT in italic and bold as expected.}}

    \textbf{\textit{5. This is NOT in bold and italic as expected.}}

\end{document}

输出如下:

在此处输入图片描述

正确的做法是怎样才能使其\setmainfont[BoldItalicFont={Times New Roman}]{DejaVu Sans}生效?

答案1

技术答案:
你说的fontspec是,每当请求粗体斜体字体时,它应该使用直立的Times New Roman。
你应该改写BoldItalicFont={Times New Roman Bold Italic}

时尚评论:
同时使用粗体和斜体通常被认为是一种不好的做法(而且,在我看来,Times New Roman Bold Italic 绝对丑陋)。它与 Dejavu Sans 的匹配度也很差,因此请考虑使用不同的衬线/无衬线字体组合。

\documentclass{article}
\usepackage{fontspec}

\setmainfont[BoldItalicFont={Times New Roman Bold Italic}]{DejaVu Sans}

\begin{document}
    1. This is normal as expected.
    \textit{2. This is in italic as expected.}
    \textbf{3. This is in bold as expected.}
    \textit{\textbf{4. This is in italic and bold as expected.}}
    \textbf{\textit{5. This is in bold and italic as expected.}}
\end{document}

文件预览

相关内容