2

I use the following code to set up the font:

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

However, when I use the font name TeX Gyre Cursor instead of the file name texgyrecursor-regular.otf, fontspec will give an error:

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 ' '

I use XeLaTeX on Linux. By the way, when compiling on Windows, there will not be this error.

MWE:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{TeX Gyre Cursor}[Ligatures=NoCommon]
\begin{document}
Hello, world!
\end{document}

Another related question is that, when font name and file name are both OK, which one is better? Is there any differences on compiling efficiency?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.