无法使用 fontspec 包选择自定义打字机字体

无法使用 fontspec 包选择自定义打字机字体

我已经从以下网址下载了 FantasqueSansMono-Normal.zip 字体这里。我提取了包含字体的 TTF fonder:

➜  naulatex git:(logical-markup) ✗ tree TTF
TTF
├── FantasqueSansMono-Bold.ttf
├── FantasqueSansMono-BoldItalic.ttf
├── FantasqueSansMono-Italic.ttf
└── FantasqueSansMono-Regular.ttf

1 directory, 4 files

我想选择此字体作为我的文档的打字机字体。根据我从fontspectexdoc 包中了解到的情况,我应该这样做:

% !TeX program = lualatex
\documentclass[11pt]{report}

\usepackage{polyglossia}
\setmainfont{CMU Serif}
\setsansfont{CMU Sans Serif}
\setmonofont{CMU Typewriter Text}
\setmonofont{TTF/FantasqueSansMono-Regular.ttf}[
    BoldFont = TTF/FantasqueSansMono-Bold.ttf,
    ItalicFont = TTF/FantasqueSansMono-Italic.ttf,
    BoldItalicFont = TTF/FantasqueSansMono-BoldItalic.ttf ]

\setmainlanguage{ukrainian}
\setotherlanguages{english, russian}


\begin{document}

    Привіт, Світ! Hello, World!

    \texttt{Some tt text}
    
\end{document}

但此设置不起作用。它会产生:

fantasque.tex|| LaTeX Font Warning: Font shape `TU/TTF/FantasqueSansMono-Regular.ttf(0)/m' undefined using `TU/lmr/m/n' instead on input line 21.
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing = inserted for ifdim.
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing = inserted for ifdim.
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing = inserted for ifdim.
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing = inserted for ifdim.
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing = inserted for ifdim.
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing = inserted for ifdim.
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing = inserted for ifdim.
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing = inserted for ifdim.
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing = inserted for ifdim.
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing = inserted for ifdim.
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing = inserted for ifdim.
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing number, treated as zero.
fantasque.tex|21 error| Illegal unit of measure (pt inserted).
fantasque.tex|21 error| Missing = inserted for ifdim.
fantasque.tex|21 error| ==> Fatal error occurred, no output PDF file produced!

文档fontspec中提到了有关真实字体之类的内容。我不明白,是 TTF 文件或 Fantasque 字体本身有问题,还是我在 LaTeX 中设置它的方式有问题。

《不那么简短的 LaTeX 简介》与我所做的一样,仅指定字体的文件路径。有什么问题?

有没有关于如何选择此字体作为 tt 或常规字体选择建议?

答案1

请使用FantasqueSansMono-Regular.ttfnot并通过keyTTF/FantasqueSansMono-Regular.ttf指定。TTF/Path

相关内容