# How to get xetex to find a Truetype font?

I'm trying to compile a lyx document that uses the Crimson font.

\setmainfont[Mapping=tex-text]{Crimson}

fontspec error: "font-not-found"

|'''''''''''''''''''''''''''''''''''''''''''''''
| A font might not be found for many reasons.
| Check the spelling, where the font is installed etc. etc.
|
| When in doubt, ask someone for help!
|...............................................


I'm on Mac OS X. I have tried everything I can think of to install this font: the ttf file for the font is in the working directory, I've installed it with the OS's font book, I've placed the ttf in my ~/.fonts folder, my ~/texmf/fonts/truetype and my /usr/local/share/fonts.

What am I missing?

If it matters, the document I'm trying to compile is IlCensore's version of Harry Potter and the Methods of Rationality from here: https://github.com/IlCensore/HPMOR-LyX

• Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – Symbol 1 Aug 7 '15 at 0:49
• Just put the font where all your system fonts are: /Library/Fonts. – Alan Munn Aug 7 '15 at 0:49
• For OS X, whenever you have a font problem, check Font Book to see if the font is (at least) available to the system. Then click Show Font Info to find out which name is the accessible one. – Symbol 1 Aug 7 '15 at 0:53
• @AlanMunn That will create a second copy of the font since the OP has already installed it in the equivalent user-level folder. That isn't a great idea as it is liable to cause problems later, especially if one or other copy later gets updated. Also, unless things have changed, FontBook is not keen on duplicates. Better to check first that it is installed and what the info says as Symbol1 suggests. – cfr Aug 7 '15 at 1:11
• In some cases in order for the font to be found Crimson.ttf may have to used where the font is indicated. In this case \setmainfont[Mapping=tex-text]{Crimson.ttf} – Leucippus Aug 7 '15 at 1:15

Assuming that the truetype and opentype versions of the Crimson font are similar, the following should work:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Crimson Roman}[Ligatures=TeX]
\begin{document}
Some text.
\end{document}


It should work if you have the truetype but, since I've got the opentype version, that's the one I actually tested.

I'm not on a Mac so I can't use FontBook to get the name. The following method will work on any unix-based system (Mac OS X, GNU/Linux etc.) and should work on Windows if the path is adapted appropriately:

otfinfo -i <path to font file>/Crimson-Roman.otf

Family:              Crimson
Subfamily:           Roman
Full name:           Crimson Roman
PostScript name:     Crimson-Roman
Version:             Version 0.8
Unique ID:           FontForge : Crimson : 28-7-2010

Full name specifies the required name.