Jérôme Belleman
Home  •  Tools  •  Posts  •  Talks  •  Travels  •  Graphics  •  About Me

XeTeX and Fonts

12 Jul 2017

What I particularly like about XeTeX is how using common TrueType and OpenType fonts is made easy. I'm describing in this post how I usually do so in Linux.

1 Fonts

XƎTEX is very good at fonts. Making a font available for XƎTEX to use is the same business as making a font available for any other more graphical program: it can be as easy as dropping the file into ~/.fonts or even in the current directory.

You'll need to specify the real name of the font in your XƎTEX code, which often isn't quite what the file name of the font will tell you. One convenient way is to use the fc-list command, which lists all the available fonts. Sometimes, a font will have a comma in its name: the actual font name will go right up to that comma. If the font is in your current directory, you can use the file name too.

2 Baseline Skip

The \fontsize{}{} command takes the baselineskip as second argument, which is basically the height of the line. There are different views as to what to set the baseline skip to. Some suggest setting it to 1.2× the font size. Some prefer to set it to \f@baselineskip to let the typesetter do the right thing, although I can't say that it has for me in the example below.

3 Sample Document

This is a bare-bones working example to get started with XƎTEX :

\documentclass{article}
\usepackage{fontspec}

\begin{document}

    \makeatletter
    \fontspec{Nimbus Roman No9 L}\fontsize{36pt}{\f@baselineskip}
    \selectfont
    \makeatother

    Blah

\end{document}

Note that the fontspec package is needed to provide the \fontspec command.

4 References