Your support for our advertisers helps cover the cost of hosting, research, and maintenance of this document

Formatting Information — An introduction to typesetting with LATEX

Appendix B: Installing new fonts

Section 2: TrueType and OpenType fonts

In this section…

  1. Font management

These types of font are already recognised by your computer, so you just install them in the normal way for your computer system (usually double-click or right-click on the font file and select Install from the menu).

On Windows and Apple Macintosh OS Xsystems, the fonts are then available immediately; on UNIX & GNU/Linux systems you must run the FontConfig utility fc-cache to give XƎLATEX fast-loading access to all the fonts you have installed. Run the program like this:

fc-cache -fv

It can take several minutes, especially if you have a lot of fonts. Once it has finished, you can search the font database with the fc-list utility and then use the grep command to refine the search for the font name or part, eg:

$ fc-list|grep -i comic|sort
/home/peter/texmf/fonts/truetype/windows/comicbd.ttf: Comic Sans MS:style=Bold
/home/peter/texmf/fonts/truetype/windows/comici.ttf: Comic Sans MS:style=Italic
/home/peter/texmf/fonts/truetype/windows/comic.ttf: Comic Sans MS:style=Regular
/home/peter/texmf/fonts/truetype/windows/comicz.ttf: Comic Sans MS:style=BoldItalic
...

You can then see the exact font name to use in your documents, eg

\usepackage{fontspec}
\setsansfont{Comic Sans MS}

B.2.1 Font management

If you want to keep your additional fonts in several different locations, you will need to tell FontConfig where to look. You may install fonts a ) in your Personal TEX Directory; b ) in the system’s shared folder; or c ) in your TEX distribution’s shared tree. You should never install fonts in your TEX distribution’s master tree, as this will get overwritten when you upgrade, whereas the shared tree is not touched.

On UNIX & GNU/Linux systems there are already .conf font configuration files in /etc/fonts/conf.avail/ for the fonts that come with the installation. You can create one or more configuration files for the installation locations you have used. Some examples are shown in Figure B.1 below: the font names shown are just suggestions: numbering them lets you group them together.

Figure B.1: Configurations for TrueType and OpenType fonts on UNIX & GNU/Linux systems

Fonts installed in a Personal TEX Directory

eg file 07-personal.conf

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <dir>/home/peter/texmf/fonts/opentype</dir>
  <dir>/home/peter/texmf/fonts/truetype</dir>
</fontconfig>
	
Fonts installed in the system’s shared folder

eg file 08-system.conf

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <dir>/usr/local/share/fonts/opentype</dir>
  <dir>/usr/local/share/fonts/truetype</dir>
</fontconfig>
	
Fonts installed in the shared folders of a TEX distribution

eg file 09-texlive.conf

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <dir>/usr/share/texlive/texmf-dist/fonts/opentype</dir>
  <dir>/usr/share/texlive/texmf-dist/fonts/truetype</dir>
  <dir>/usr/share/texmf/fonts/opentype</dir>
  <dir>/usr/share/texmf/fonts/truetype</dir>
  <dir>/usr/local/texlive/2023/texmf-dist/fonts/opentype</dir>
  <dir>/usr/local/texlive/2023/texmf-dist/fonts/truetype</dir>
  <dir>/usr/local/share/texmf/fonts/opentype</dir>
  <dir>/usr/local/share/texmf/fonts/truetype</dir>
</fontconfig>
	

Running fc-cache again will now index all the extra directories you have given.