fontspec 中的字体名称与文件名

fontspec 中的字体名称与文件名

我使用以下代码来设置字体:

\setmainfont{texgyrecursor-regular.otf}[Ligatures=NoCommon]

然而,当我使用字体名称 TeX Gyre Cursor而不是文件名 texgyrecursor-regular.otffontspec会报错:

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}

另外一个相关的问题是,字体名称和文件名都可以,哪个更好?编译效率有区别吗?

相关内容