11

I need to use some system fonts in my document, and I use fontspec and XeLaTeX to do so. I find the font name from fc-list, but when I compile it with XeLaTeX, there's a fontspec error:

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! fontspec error: "font-not-found"
! 
! The font "Luxi Serif" cannot be found.
! 
! See the fontspec documentation for further information.
! 
! For immediate help type H <return>.
!...............................................  

l.21 \setmainfont{Luxi Serif}

I just migrated from Linux to Mac OS X. Back when I was using Linux machine XeLaTeX works with system fonts. It seems on Mac fontspec can't find fonts from system directory.

fc-list|grep "Luxi Serif"

shows

/usr/X11R6/lib/X11/fonts/...
/opt/X11/share/fonts/...

I checked the permissions of directories and font files, nothing wrong.

There are many font directories on Mac, is it possible to allow the use of fonts in all the directories?

2
  • 2
    The location for system fonts in Mac OS X is /Library/Fonts. Put them there, or add a symbolic link there to other directories.
    – Alan Munn
    Sep 27, 2012 at 15:47
  • 2
    XeTeX does not use FontConfig on Mac, so whether the fonts are seen by fc-list or not does not matter, they need to seen by Mac font services. Sep 27, 2012 at 16:56

2 Answers 2

7

If you use the \setmainfont directive rather than a \fontspec directive, I believe it's necessary to specify the font by its system name rather than by the file name. E.g., Luxi Serif.

Assuming you've downloaded and activated all four fonts of the Luxi Serif font family, the following MWE shows how to load and make use of them.

% !TEX TS-program = xelatex
\documentclass{article}
\usepackage{fontspec}
\setmainfont{Luxi Serif}
\newcommand\qbf{The quick brown fox jumps over the lazy dog.}
\begin{document}
\qbf

\emph{\qbf}

\textbf{\qbf}

\em\bfseries\qbf
\end{document}

enter image description here

Incidentally, Luxi Serif is not a system font -- at least not for MacOSX 10.7.x "Lion". If XeTeX (and LuaTeX) can't find this font, it's almost certainly the case that it wasn't activated in a way MacOS expects it to be activated. How did you obtain the fonts, and in which directory are they located right now?

One way to activate fonts correctly after you've downloaded them is to open a Finder window with the directory to which the fonts were downloaded, double-click on each of the font files in turn, and then to click on the "Install Font" button located in the lower right corner of the window that opens. The fonts you download and activate in this fashion will likely be stored in a folder called /Users/<username>/Library/Fonts, where <username> will be your login name on your system.

3
  • I did not download or manually install the Luxi series. I'm on Mountain Lion, if Luxi series are not preinstalled in Mountain Lion, then they must have come from MacTex 2012.
    – Ivy Lee
    Sep 30, 2012 at 14:33
  • @IvyLee - thanks for providing this follow-up information. If the Luxi fonts are indeed a part of MacTeX2012 (which, by the way, wasn't the case for my installation of MacTeX2012...), it would appear that you still need to activate them before XeLaTeX and LuaLaTeX can use them. Locate the font files (likely called luxirr.ttf, luxirri.ttf, etc.), and then activate them using, e.g., the method I describe in my answer.
    – Mico
    Sep 30, 2012 at 15:25
  • thanks! turns out luxi fonts are not installed but they appear on fc-list!
    – Ivy Lee
    Oct 25, 2012 at 13:31
1

Select the same spelling case as you will find in your word processor, not your font file. I just had the same problem.

\documentclass{minimal}
\usepackage{fontspec}
\setromanfont{Script MT Bold}
\begin{document}
Lorem ipsum... Jacolyn
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .