设置“字体粗细:较浅/较粗”

设置“字体粗细:较浅/较粗”

我需要知道如何设置“字体粗细:更浅/更粗”

字体粗细:更细/更粗

\documentclass{article} 
\usepackage{fontspec}
\begin{document} 
\font\ta="Times New Roman":color=ff0000 at 10pt
\font\tenrm = cmr17 at 10pt

\font\scra="Charis SIL/m" at 12pt
\font\scrb="Charis SIL/b" at 12pt
\font\scrc="Charis SIL/bx" at 12pt
\font\scrd="Charis SIL/sb" at 12pt
\font\scre="Charis SIL/c" at 12pt


\font\scrTa="Times New Roman/m" at 12pt
\font\scrTb="Times New Roman/b" at 12pt
\font\scrTc="Times New Roman/bx" at 12pt
\font\scrTd="Times New Roman/sb" at 12pt
\font\scrTe="Times New Roman/c" at 12pt


\ta{font-weight: lighter/ bolder }

m Medium
b Bold
bx Bold extended
sb Semi-bold
c Condensed

\scra{am Medium}
\scrb{ab Bold}
\scrc{abx Bold extended}
\scrd{asb Semi-bold}
\scre{ac Condensed}


\scrTa{am Medium}
\scrTb{ab Bold}
\scrTc{abx Bold extended}
\scrTd{asb Semi-bold}
\scrTe{ac Condensed}


\afseries{ultralight}
\lfseries{light}
\sfseries{semibold}
\bfseries{bold}
\cfseries{black}
\xfseries{extra black}

\afseries ultralight
\lfseries light
\sfseries semibold
\bfseries bold
\cfseries black
\xfseries extra black

\tenrm{T1 classT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clas }

\end{document}

请帮我。

谢谢

答案1

您发布的代码存在各种问题。

  1. 您正在使用 TeX 原语来选择字体,而不是包提供的 LaTeX 命令fontspec

  2. 如果特定字体没有不同的粗细,那么无论选择多少都不会导致粗细出现。例如,Charis SIL 仅提供常规、粗体、斜体和粗斜体。

  3. 即使使用 XeTeX 命令而不是命令fontspec,字体名称的“/”后缀也必须是大写,而不是小写,并且(至少从 XeTeX 文档来看)只有四种可能性:B、I、BI 和 IB(后两者相同)。

因此,对于其他粗细,我认为您需要直接按名称选择字体。这是使用fontspec命令和 Minion Pro 的文档版本,它具有各种粗细(在我的系统上)。如果您想在没有粗细的字体中使用粗体,您可以[AutoFakeBold]在加载字体时使用该选项。

% !TEX TS-program = XeLaTeX

\documentclass{article} 
\usepackage{fontspec}
\setmainfont{Minion Pro}
\newfontfamily\semibold{Minion Pro Semibold}
\newfontfamily\condensed{Minion Pro Bold Cond}
\newfontfamily\regsemi[BoldFont={* Bold Cond}]{Minion Pro}
\newfontfamily\regitbold[BoldFont={* Bold Italic}]{Minion Pro}
\begin{document} 


{\semibold Some semibold text.}

{\condensed Some bold condensed.}

{\regsemi Regular with \textbf{Semibold} as the bold font.}

{Regular with \textbf{Bold} as the bold font. }

{\regitbold Regular with \textbf{Bold Italic} as the bold font.}
\end{document}

代码输出

相关内容