我使用以下代码来设置字体:
\setmainfont{texgyrecursor-regular.otf}[Ligatures=NoCommon]
然而,当我使用字体名称 TeX Gyre Cursor
而不是文件名 texgyrecursor-regular.otf
,fontspec
会报错:
kpathsea:make_tex: Invalid fontname `TeX Gyre Cursor', contains ' '
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! fontspec error: "font-not-found"
!
! The font "TeX Gyre Cursor" cannot be found.
!
! See the fontspec documentation for further information.
!
! For immediate help type H <return>.
!...............................................
l.4 ...infont{TeX Gyre Cursor}[Ligatures=NoCommon]
kpathsea:make_tex: Invalid fontname `TeX Gyre Cursor', contains ' '
kpathsea:make_tex: Invalid fontname `TeX Gyre Cursor', contains ' '
kpathsea:make_tex: Invalid fontname `TeX Gyre Cursor/BI', contains ' '
kpathsea:make_tex: Invalid fontname `TeX Gyre Cursor', contains ' '
kpathsea:make_tex: Invalid fontname `TeX Gyre Cursor/B', contains ' '
kpathsea:make_tex: Invalid fontname `TeX Gyre Cursor', contains ' '
kpathsea:make_tex: Invalid fontname `TeX Gyre Cursor/I', contains ' '
kpathsea:make_tex: Invalid fontname `TeX Gyre Cursor', contains ' '
我在Linux上使用XeLaTeX。顺便说一下,在Windows上编译时,不会出现此错误。
梅威瑟:
\documentclass{article}
\usepackage{fontspec}
\setmainfont{TeX Gyre Cursor}[Ligatures=NoCommon]
\begin{document}
Hello, world!
\end{document}
另外一个相关的问题是,字体名称和文件名都可以,哪个更好?编译效率有区别吗?