Adding Fonts to XeTeX

From UCB Math Wiki
Revision as of 16:37, 2 February 2010 by Vojta (talk | contribs) (Initial creation)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This wiki page describes the procedure for adding fonts to XeTeX (and XeLaTeX).

If the fonts are provided in MetaFont format, then it's best to add them using the procedure for Adding Fonts to TeX. This is also true for PostScript Type 1 fonts that have already been packaged for TeX (unless their packaging is specific to XeTeX).

Fonts that have not been already packaged for TeX, and fonts that have been packaged specifically for XeTeX, can be added using the following procedure.

The font(s) should be in PostScript Type 1 format, TrueType format, or OpenType format. You can either put the .pfa, .pfb, .ttf, or .otf file in the directory where you'll be running XeTeX or XeLaTeX, or you can create a directory texmf/fonts/type1, texmf/fonts/truetype, or texmf/fonts/opentype (as appropriate) in your home directory, and store the font file in that directory or a subdirectory of it. In the latter case, you should run the program

texhash

so that XeTeX can find the font file more readily.

You can then access the font file by name in the TeX \font command:

\font \stix="[STIXGeneralBol.otf]" at 11pt

for example. (Note, however, that the STIX fonts are already installed on the math network.)

For XeLaTeX, use the fontspec package. The web page http://www.cstug.cz/aktivity/2007/CSTUG-talk.pdf may be useful.