Using TrueType fonts with TexLive pdftex/pdflatex

by Martin Monperrus

^^This document presents how to use TrueType fonts with pdftex or pdflatex on Unix/Linux Box (e.g. Times New Roman, Verdana, Arial or DejaVu). Compared to similar posts, it’s not related to miktex, or xetex, but really targets a standard Linux [[http://www.tug.org/texlive/|Tex Live distribution]]. This post is largely inspired from [[http://www.radamir.com/tex/ttf-tex.htm|“Using TrueType fonts with TeX (LaTeX) and pdfTeX (pdfLaTeX)”]] ^^

=====Getting the TrueType files=====

To find the TrueType fonts installed on your machine: ’‘$ locate -r “\.ttf$”’’

NB: Installing the Microsoft web fonts (Times New Roman, Verdana, Arial, etc.) is done with package ‘’ttf-mscorefonts-installer’‘:’‘$ sudo apt-get install ttf-mscorefonts-installer’’

TrueType fonts have different versions (mainly bold, italic, bold-italic). For instance, Verdana is available as ‘’verdanab.ttf’’ (bold), ‘’verdanai.ttf’’ (italic), ‘’verdana.ttf’’ (normal), ‘’verdanaz.ttf’’ (bold-italic)

=====Installing the fonts files in your Texlive directory=====

’‘$ mkdir -p /usr/share/texmf/fonts/truetype/ms’’ ’‘$ cp verdanab.ttf verdanai.ttf verdana.ttf verdanaz.ttf /usr/share/texmf/fonts/truetype/ms’’

=====Creating the Adobe font metrics files===== ^^You first have to check that you have the correct encoding file ‘’T1-WGL4.enc’‘. It is shipped with the package’‘texlive-font-utils’’ and can be found in ’‘/usr/share/texmf/fonts/enc/ttf2pk/base/T1-WGL4.enc’’. Otherwise, you can download it at [[http://www.tex.ac.uk/tex-archive/fonts/verdana/T1-WGL4.enc]].^^

ttf2afm is a utility to generate AFM files for TrueType fonts. ’‘$ ttf2afm -e T1-WGL4.enc -o ecverdana.afm verdana.ttf’’ ’‘$ ttf2afm -e T1-WGL4.enc -o ecverdanai.afm verdanai.ttf’’ ’‘$ ttf2afm -e T1-WGL4.enc -o ecverdanab.afm verdanab.ttf’’ ’‘$ ttf2afm -e T1-WGL4.enc -o ecverdanaz.afm verdanaz.ttf’’

=====Creating TeX font metrics===== afm2tfm converts Adobe font metrics to TeX font metrics ’‘$ afm2tfm ecverdana.afm -T T1-WGL4.enc ecverdana.tfm’’ ’‘$ afm2tfm ecverdanai.afm -T T1-WGL4.enc ecverdanai.tfm’’ ’‘$ afm2tfm ecverdanab.afm -T T1-WGL4.enc ecverdanab.tfm’’ ’‘$ afm2tfm ecverdanaz.afm -T T1-WGL4.enc ecverdanaz.tfm’’

Then you can copy all those font metrics in your TeXLive directory: ’‘$ mkdir -p /usr/share/texmf/fonts/tfm/ms’’ ’‘$ cp ecverdanab.tfm ecverdanai.tfm ecverdana.tfm ecverdanaz.tfm /usr/share/texmf/fonts/tfm/ms’’

Now you can refresh the texlive cache: ’‘$ mktexlsr’’

=====Updating the font map file===== pdftex/pdflatex are configured with a map file that is generally in ’‘/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map’‘. If the file is not there, you can find it with’‘$ echo “\bye” | pdftex story’’.

At the end of this file add:
ecverdana Verdana " T1Encoding ReEncodeFont " <verdana.ttf T1-WGL4.enc
ecverdanai Verdana-Italic " T1Encoding ReEncodeFont " <verdanai.ttf T1-WGL4.enc
ecverdanab Verdana-Bold " T1Encoding ReEncodeFont " <verdanab.ttf T1-WGL4.enc
ecverdanaz Verdana-BoldItalic " T1Encoding ReEncodeFont " <verdanaz.ttf T1-WGL4.enc

NB: ’‘/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map’’ may be generated with updmap (see below). In this case, your changes may be overriden.

=====Creating the LateX style file===== In your local working directory or in say ’‘/usr/share/texmf/tex/latex/truetype/’’ add a file called ‘’verdana.sty’’ (you may have to run again mktexlsr) . This file contains:
\DeclareFontFamily{T1}{verdana}{}%
\DeclareFontShape{T1}{verdana}{b}{n}{<->ecverdanab}{}%
\DeclareFontShape{T1}{verdana}{b}{it}{<-> ecverdanaz}{}%
%% bold extended (bx) are simply bold
\DeclareFontShape{T1}{verdana}{bx}{n}{<->ssub * verdana/b/n}{}%
\DeclareFontShape{T1}{verdana}{bx}{it}{<->ssub * verdana/b/it}{}%
\DeclareFontShape{T1}{verdana}{m}{n}{<-> ecverdana}{}%
\DeclareFontShape{T1}{verdana}{m}{it}{<-> ecverdanai}{}%
\usepackage[T1]{fontenc}%
\renewcommand{\rmdefault}{verdana}%
\renewcommand{\sfdefault}{verdana}%
No you can compile with pdflatex:
\documentclass{article}
\usepackage{verdana}
\usepackage[utf8]{inputenc}
\begin{document}
The quick brown fox jumps over the lazy dog
tést für
\end{document}
Check that it works: ’‘$ pdffonts test.pdf’’
name                                 type              emb sub uni object ID
------------------------------------ ----------------- --- --- --- ---------
HCJVNW+Verdana                       TrueType          yes yes no       4  0

=====Coping with udpmap===== Create a file ’‘/etc/texmf/updmap.d/60-ttf.cfg’’ simply containing the line: ‘’Map ttf.map’’

Then the file ’‘/usr/share/texmf/fonts/map/pdftex/updmap/ttf.map’’ should contain:
ecverdana Verdana " T1Encoding ReEncodeFont " <verdana.ttf T1-WGL4.enc
ecverdanai Verdana-Italic " T1Encoding ReEncodeFont " <verdanai.ttf T1-WGL4.enc
ecverdanab Verdana-Bold " T1Encoding ReEncodeFont " <verdanab.ttf T1-WGL4.enc
ecverdanaz Verdana-BoldItalic " T1Encoding ReEncodeFont " <verdanaz.ttf T1-WGL4.enc

This is sufficient to resist to a full updmap session: ’‘$ mktexlsr’’ ’‘$ update-updmap’’ ’‘$ updmap-sys’’

Eventually the content of ‘’ttf.map’’ should appear in ‘’pdftex.map’’ (aforementioned) as expected.

Tagged as: