我正在尝试使用fontspec
不在我已知路径中的特定字体文件。
\setmainfont
[Path = Fonts/Cormorant_Garamond/,
ItalicFont = CormorantGaramond-Italic,
BoldFont = CormorantGaramond-Bold,
BoldItalicFont = CormorantGaramond-BoldItalic,
SmallCapsFont = Cormorant-SmallCaps]
{CormorantGaramond-Regular.ttf}
我尝试搜索此网站以寻找问题的答案,但未找到任何有用的方法。使用上述代码,我可以获得粗体和斜体字体,但不能获得小写字母。任何帮助都将不胜感激。谢谢。
答案1
您应该使用font family name
( Cormorant Garamond
),而不是file name
。以下示例代码适用于.otf
字体版本。请注意,此字体在常规和粗体中有小写字母,但在斜体和粗斜体中没有,如 所示 otfinfo
。
\documentclass{article}
\usepackage{verse}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}
\setmainfont{Cormorant Garamond}
\defaultfontfeatures{Numbers = {OldStyle,Proportional}}
\begin{document}
\settowidth{\versewidth}{There was a young person of Crete}
\begin{verse}[\versewidth]
There was a Young Person of \textsc{Crete},\\
Whose toilette was far from complete;\\
\bfseries
She dressed in a sack,\\
Spickle-speckled with black,\\
That ombliferous person of \textsc{Crete}.\\[2ex]
\makebox[\versewidth][r]{\mdseries
Edward \textsc{Lear}}
\end{verse}
\end{document}