Alegreya 字体有(我从德语翻译过来)“黑色”、“非常粗体”、“粗体”、“中等”和“标准”。我读过关于重新定义粗体半粗体的文章,但我找不到任何可以制作不同版本的粗体的方法。我如何定义 4 种不同的粗体版本。所有这些都有斜体版本。对这些版本该怎么做?
答案1
仅列出所有字体。
\documentclass{article}
\usepackage{fontspec}
\setmainfont{Alegreya}[
Extension=.otf,
UprightFont=*-Regular,
UprightFeatures={SmallCapsFont=*SC-Regular},
ItalicFont=*-Italic,
ItalicFeatures={SmallCapsFont=*SC-Italic},
BoldFont=*-Bold,
BoldFeatures={SmallCapsFont=*SC-Bold},
BoldItalicFont=*-BoldItalic,
BoldItalicFeatures={SmallCapsFont=*SC-BoldItalic},
FontFace={sb}{n}{*-Medium},
FontFace={sb}{it}{*-MediumItalic},
FontFace={sb}{sc}{*SC-Medium},
FontFace={sb}{scit}{*SC-MediumItalic},
FontFace={ub}{n}{*-ExtraBold},
FontFace={ub}{it}{*-ExtraBoldItalic},
FontFace={ub}{sc}{*SC-ExtraBold},
FontFace={ub}{scit}{*SC-ExtraBoldItalic},
FontFace={k}{n}{*-Black},
FontFace={k}{it}{*-BlackItalic},
FontFace={k}{sc}{*SC-Black},
FontFace={k}{scit}{*SC-BlackItalic},
]
\DeclareTextFontCommand{\textsemibold}{\fontseries{sb}\selectfont}
\DeclareTextFontCommand{\textblack}{\fontseries{k}\selectfont}
\DeclareTextFontCommand{\textextrabold}{\fontseries{ub}\selectfont}
\begin{document}
Normal \textit{Italic} \textbf{Bold} \textbf{\textit{Bold Italic}}
\textsc{Small Caps} \textbf{\textsc{Bold SC}} \textit{\textsc{Italic SC}} \textbf{\textit{\textsc{Bold Italic SC}}}
\textsemibold{Medium} \textsemibold{\textit{Medium Italic}}
\textsemibold{\textsc{Medium SC}} \textsemibold{\textit{\textsc{Medium Italic SC}}}
\textextrabold{Extra Bold} \textextrabold{\textit{Extra Bold Italic}}
\textextrabold{\textsc{Extra Bold SC}} \textextrabold{\textit{\textsc{Extra Bold Italic SC}}}
\textblack{Black} \textblack{\textit{Black Italic}}
\textblack{\textsc{Black SC}} \textblack{\textit{\textsc{Black Italic SC}}}
\end{document}
如果愿意,可以更改命令名称。
为了更好地进行比较,请看下表。
pdflatex
\documentclass{article}
\usepackage{Alegreya}
\usepackage{booktabs,array}
\DeclareTextFontCommand{\textsemibold}{\AlegreyaMedium}
\DeclareTextFontCommand{\textblack}{\AlegreyaBlack}
\DeclareTextFontCommand{\textextrabold}{\AlegreyaExtraBold}
\begin{document}
\begin{tabular}{@{}>{\sffamily}lll@{}}
\toprule
\sffamily Weight & \multicolumn{2}{c@{}}{\sffamily Shape} \\
\cmidrule(l){2-3}
& \multicolumn{1}{c}{\sffamily Upright} & \multicolumn{1}{c@{}}{\sffamily Italic} \\
\midrule
Normal & Normal & \textit{Italic} \\
Normal SC & \textsc{Small Caps} & \textit{\textsc{Italic SC}} \\
Medium & \textsemibold{Medium} & \textsemibold{\textit{Medium Italic}} \\
Medium SC & \textsemibold{\textsc{Medium SC}} & \textsemibold{\textit{\textsc{Medium Italic SC}}} \\
Bold & \textbf{Bold} & \textbf{\textit{Bold Italic}} \\
Bold SC & \textbf{\textsc{Bold SC}} & \textbf{\textit{\textsc{Bold Italic SC}}} \\
Extra Bold & \textextrabold{Extra Bold} & \textextrabold{\textit{Extra Bold Italic}} \\
Extra Bold SC & \textextrabold{\textsc{Extra Bold SC}} & \textextrabold{\textit{\textsc{Extra Bold Italic SC}}} \\
Black & \textblack{Black} & \textblack{\textit{Black Italic}} \\
Black SC & \textblack{\textsc{Black SC}} & \textblack{\textit{\textsc{Black Italic SC}}} \\
\bottomrule
\end{tabular}
\end{document}
该表将与上面的表相同。