Skip to main content

Section 37.2 Processing with xelatex

TrueType fonts (TTF, *.ttf files) have been improved upon by the creation of OpenType fonts (OTF, *.otf files). The main difference is that OTF fonts have a variety of features which can be selected or not. It is also easier to directly select a particular glyph (realization of a character) by specifying its numerical code point as a Unicode character. For the remainder, we will reference OTF fonts only, but nearly everything applies equally well to TTF fonts.

The main difference with xelatex and OTF fonts is that xelatex expects the font files to be part of the system software and are managed by the operating system and its tools. So, for example, in the example above installing the iwona package will place files into your texmf tree, where they remain unknown to your operating system. So you will need to learn how to use your operating system to locate and install OTF files (or make them known to your operating system). With luck, popular fonts may be easy to install using your system's package manager.

So installing fonts into a system is a bit of a hurdle, and as a style writer, you are reliant on authors who use your style to understand this requirement.

Locating an OTF font.

Since I have the iwona package, I can expect the OTF version of the font to be somewhere. I know I have the package by using a TeXLive tool to search for the style file.

kpsewhich iwona.sty

will return the full path to that file.

On my Linux system, with TeXLive installed via a Debian/Ubuntu package, I can locate the main OTF file for the Iwona font by exploring the relevant directories (fonts/opentype looks promising), or I can use the system find utility to search for filenames with iwona or Iwona in the name. There it is:


You can simultaneously determine if you have a font, and if it is known to your system with the fc-list command from the fontconfig utility. The produces a lot of output, with one line per file, but it includes file names and the human-readable name of each font. You can pipe the output through grep to find what you are looking for, for example

fc-list | grep "Latin Modern"
Making an OTF font known to the system.

On my Linux system, I need to copy this file (and its companions) into the system directory


and reboot, or rebuild the font cache with

fc-cache -f -v

Finally, I can check that the font is known to the system with


On a Mac, we have several reports for how to do this.

  • Mitch Keller reports on 2019-01-02 that “I opened the directory on my hard drive containing the OTF file, double clicked on the font (opens the macOS application Font Book, which comes with the OS), and then clicked the Install Font button.”

  • Karl-Dieter Crisman reports on 2019-07-01 that “I was able to use some fonts already existing in TeXLive with a symbolic link to the Font Book, as suggested at Ask Different 1 :

    ln -s
      '/Library/Fonts/Latin Modern'
    where 2018 indicates when I updated my Live distribution.”
Information about an OTF font.

To learn more about this particular font TeXLive provides an executable, otfinfo, which I can use as (omitting the long directory path here for clarity)

otfinfo -i Iwona-Regular.otf

The first part of the output is

            Family:              Iwona
            Subfamily:           Regular
            Full name:           Iwona-Regular
            PostScript name:     Iwona-Regular

The critical piece of information here is the font's name: Iwona-Regular. I can also learn which OpenType features are available

            $ otfinfo -f Iwona-Regular.otf

            aalt    Access All Alternates
            c2sc    Small Capitals From Capitals
            cpsp    Capital Spacing
            dlig    Discretionary Ligatures
            dnom    Denominators
            frac    Fractions
            hist    Historical Forms
            kern    Kerning
            liga    Standard Ligatures
            lnum    Lining Figures
            numr    Numerators
            onum    Oldstyle Figures
            ordn    Ordinals
            pnum    Proportional Figures
            sinf    Scientific Inferiors
            smcp    Small Capitals
            ss02    Stylistic Set 2
            sups    Superscript
            tnum    Tabular Figures
            zero    Slashed Zero

This will all be useful shortly.

Using an OTF font with xelatex.

Depending on the package, now it can be as simple as simply including \usepackage{} in your preamble and the font can be used with different weights and shapes, and certain features are enabled. However, sometimes you want more control, or you want to use more than one font in a document. Now the fontspec package is your tool of choice.

The simplest example of using fontspec would be to recall the font name from above, and in your preamble use


This font name has the hyphen in lieu of a space, but names with spaces are just fine. An optional argument will let you customize the use of the font, such as turning on some of the features. Read the fontspec documentation for all the finer points. Hopefully this has given you a start.

Note that fontspec has a Path= option. A tempting shortcut is to just point to the *.otf file in your texmf tree. But as a style writer, this is a really bad idea, since other authors who use your style may have their font files in a different location. Better to employ the font by name and require authors to understand (or learn) their system software.

Create a file (from scratch) containing some Myanmar (Burmese) characters. The Kermit Project UTF-* Sampler 2  is a great source for these sorts of experiments. The Noto font is a project to make a huge collection of harmonious fonts for much of the world's languages. Use what you have learned here to render your sample using a Noto font via both pdflatex and xelatex. Extra credit if you can explain the name Noto.

Plans, as of 2019-11-09.

We have experimental code in place to allow a style writer to place font information into the preamble in the right place. We are adding font-changing commands into other configurations in the preamble, so that pieces of a document (e.g. the page header) will automatically use a particular font easily.

We have long been using the polyglossia package to manage multiple languages in one document, and will continue to do so, perhaps. This package relies heavily on fontspec. We intend to hide the details of polyglossia from authors and from style writers, relying on just the specification of @xml:lang attributes to control font changes.