I am trying to customize this document, it's a CV template for XeTeX. What I'd like to be able to do is change the main font. I belive the section of the code I need to change is this:

\setmainfont[SmallCapsFont = Fontin SmallCaps]{Fontin}

I downloaded and installed Fontin just to be able to see the document in its original form before trying to customize it. It works fine.

Now I need some other fonts to try, and I can't figure out how to find out the font names I could use. I tried a few well-known names like Times and Verdana, these fonts were not found. Also tried some font names I have found in different documents and webpages, eg. Cambria, TeX Gyre Bonum, Lucida Grande, which were rejected because either they were not found or their names contained an illegal character: a space. (Which pretty much stunned me since the fontspec documentation is full of multi-word font names...)

The documentation on the fontspec package (v2.1e 2010/11/17) doesn't help me much. All it says about this is "TODO: add explanation for how to find out what the font name is."

So how do I find the names of the fonts I can use?

Edit: I'm using Ubuntu 10.10 with the latest TeXlive 2010 from tug.org.

  • What OS are you using? Windows/OSX/Linux? – Alan Munn Feb 23 '11 at 21:44
  • @Alan: added info. – Heisenb0rg Feb 23 '11 at 21:46
  • 2
    I don't use Linux, so I'm not an expert here; can you see what fonts are available to XeTeX using the fc-list command line tool? (P.S. In the next release fontspec will be slightly better at reporting when a font can't be found — no more ‘illegal character’ errors.) – Will Robertson Feb 24 '11 at 5:19

Your operating system should have some font previewer that shows the font name when you double click on a file. Spaces should not pose any problems (e.g. \setmainfont{Linux Libertine O} works if you have the otf version of Linux Libertine installed). The error message for fonts with spaces that are not found is rather misleading. It means that the font is not installed and not that spaces are not allowed.

Of course you can only use fonts that are actually installed on your system. Under Linux, fonts are (I think) usually under /usr/share/fonts/ and $HOME/.fonts. Also try locate .ttf and locate .otf.

Fonts that are installed with your TeX distribution (like the TeX Gyre fonts; look in .../texmf-dist/fonts) need to be called with their file name (in XeTeX, LuaTeX accepts the font name). For example,

    UprightFont= *-regular,
  • You say, for XeTeX I need to specify the file name, how come it perfectly works with Fontin? (I installed Fontin under ~/.fonts/fontin and ran fc-cache -fv.) – Heisenb0rg Feb 23 '11 at 21:56
  • @Heisenb0rg: You need to specify the file name if the font is not in one of the system font directories, but is in one of the TeX font directories (don't ask me why). In my example, TeX Gyre Termes is located in usr/local/texlive/2010/texmf-dist/fonts/opentype/public/tex-gyre/. (Also, you don't need to run fc-cache. Just dropping the font in ~/.fonts/ is enough.) – Caramdir Feb 24 '11 at 0:02
  • Miktex has no problems to find a font by font name in the texmf-trees. E.g. \setmainfont{TeX Gyre Termes} finds J:/MiKTeX2.9/fonts/opentype/public/tex-gyre/texgyretermes-regular.otf. Perhaps it works because miktex added to localfonts.conf in fontconfig/config beside others the entry <dir>J:\MiKTeX2.9\fonts\opentype</dir> – Ulrike Fischer Feb 24 '11 at 10:46

Besides the font viewer of your operating systems, you can also use Eddie Kohler’s LCDF Type Software otfinfo to find the font family name of OpenType and TrueType fonts:

$ otfinfo --family texgyreheros-regular.otf
TeX Gyre Heros

$ otfinfo --family Cambria.ttf

If you are on a Macintosh computer and want to use one of the system font with the .dfont-extenstion, you can use the Fondu software to convert them to TrueType.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.