TrueType- and Type1-Fonts in Texlive/Xetex

Font-Management in TeX is a huge mess. It’s such a mess that there is not even one coherent tutorial on how to install fonts exists, and nobody ever automated it. Imagine: You put your TrueType or Type1 fonts somewhere into /usr/share/fonts, your system regenerates its font-cache, and they not only are available for KDE, Gnome, Mozilla and OpenOffice, but also for TeX? You wish. Instead you’re expected to produce custom font-encoding files by hand, extract font-metric-files (tfm) out of TrueType-files, invent 6-letter font-shortcut-names, and edit some other files in order that TeX can find them with these shortcut-names. In other words, the whole thing should be burned at the stake, shredded, buried and shot into outer space.

The only thing that actually works out of the Box is XeTeX/XeLaTeX:

apt-get install texlive-xetex

Now you need to know the correct name of the font you want to use, as reported by fc-list:

$ fc-list | grep Bastarda
MA Bastarda1 15th:style=Normal

And you can use this in TeX-documents:

\documentclass{article}
\usepackage{fontspec,xunicode,xltxtra}
\setmainfont{MA Bastarda1 15th}
\begin{document}
Test. Umlauts need to be UTF-8 encoded: ÀöÌ
\end{document}

If your TeX-document happens to use utf8mb4 instead of utf8, recode will help:

recode utf8mb4..utf8 whetever.tex

Now you need to use xelatex instead of texi2pdf or pdflatex to produce a pdf-file:

$ xelatex whatever.tex

That’s it, and that’s how it should bloody work everywhere, with every TeX-util of the day you might want to use.

Comments are closed.