Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

One of the annoying aspects of LaTeX is the limited number of fonts that come by default, and the pain involved in making new fonts 'LaTeX' ready. I have a collection of truetype fonts that I'd like to prepare for use, and I definitely want to make sure I have vector versions of these fonts (i.e not type 3/bitmapped versions). Is there a relatively painless way to do this ?

share|improve this question
Short answer: not really. I had to do it once 6 years ago to get some additional Chinese fonts working with CJKlatex, and all I can remember of that experience is that it was a complete pain and I would never, ever try to do that again. –  Willie Wong Jul 27 '10 at 1:39
@Willie: This is an example of the all-too-common XY problem: the answer to "is there a painless way to generate latex font metrics from TTF fonts?" may well be "not really", but the XeLaTeX mention below is an answer to the question of "is there a painless way of using TTF fonts in a document?". :-) –  ShreevatsaR Jul 27 '10 at 4:12
@ShreevatsaR: you are absolutely right. I didn't even consider the second option as being the question that was asked. My bad. –  Willie Wong Jul 27 '10 at 5:03
@ShreevatsaR: exactly. It's not obvious from the question whether latex engine is a must, or any engine capable of processing LaTeX syntax is fit for the answer. Also it hasn't been specified which type of output is expected: dvi, ps, pdf, svg, or all of the above. –  Dima Jul 27 '10 at 12:38
There is a nice TUGboat article by S. Kroonenberg called "Font installation the shallow way" <tug.org/TUGboat/Articles/tb27-1/tb86kroonenberg-fonts.pdf>;. The article provides a number of examples of how to use different kinds of fonts with (pdf)LaTeX. –  Martin Heller Aug 10 '10 at 18:26
show 4 more comments

5 Answers

up vote 20 down vote accepted

One solution is to use XeLaTeX, which lets you use system fonts (mostly) hassle-free.

share|improve this answer
does that work in linux, and how does it help with installing fonts ? –  Suresh Jul 27 '10 at 0:48
XeLaTeX works on linux (and is probably installed already). It's a separate TeX engine, produces PDFs, and can use truetype fonts directly. –  ShreevatsaR Jul 27 '10 at 1:38
I helps with installaing fonts, since nothing special needs to be done at all to use an already available system ttf font. –  Dima Jul 27 '10 at 1:54
That is the only viable solution now. It's 2011, we have XeLaTeX and LuaLaTeX, and they work. So use them. –  Martin Schröder Aug 24 '11 at 10:07
add comment

The process for PdfTeX is something like this (depends a little bit on your distribution):

  1. Get autoinst.pl from Fontools from CPAN
  2. Get otf2tfm from lcdf-typetools
  3. Run autoinst.pl (using Perl) on all ttfs
  4. Add generated PdfTeX font mapping (in MikTeX for instance initexmf --edit-config-file updmap, add Map yourmap.map and run initexmf --mkmaps)

You can do the whole process manually as well (autoinst.pl is nothing but a smart wrapper):

  1. Create tfm metrics and a ttfonts.map using ttf2tfm
  2. Create virtual font tables using vptovf
  3. Create afm metrics using ttf2afm
  4. Create pdf font map using afm2tfm
  5. Put *.tfm, *.afm, *.ttf, *.vf into the fonts/tfm/ etc.
  6. Add the font maps
  7. Create a package/sty to pull the various fonts into a font family (this is where I am stuck)

My ruby script for running the commands looks like this:

require 'fileutils'  

basename = "Nexus"

open("#{basename}.map", 'a') { |pdfFontMap|

    Dir["#{basename}*.ttf"].each{ |file|

        file.sub!(/\.ttf$/, "")

        ttf = "#{file}.ttf"

        file.gsub!(/_/,"") # Remove underscores

        puts `ttf2tfm #{ttf} -q -T T1-WGL4.enc -v ec#{file}.vpl rec#{file}.tfm >> ttfonts.map`

        puts `vptovf ec#{file}.vpl ec#{file}.vf rec#{file}.tfm`

        puts `ttf2afm -e T1-WGL4.enc -o rec#{file}.afm #{ttf}`

        pdfFontMap.puts `afm2tfm rec#{file}.afm -T T1-WGL4.enc rec#{file}.tfm`.gsub(/\r|\n/, "") + " <#{ttf}"

You can find more details about the manual way in:



  • Run initexmf --update-fndb EVERY time new files are put somewhere
share|improve this answer
I don't know if initexmf is an old invocation or a MiKTeX specific one but it is not something you should or could do in TeX Live at any time, let alone every time new files are put somewhere. Moreover, there is no required equivalent if you install into TEXMFHOME. Moreover describing this as 'the process for pdfTeX' is wrong. It is a process. It is not the only one. Also, I am pretty sure the manual process is mis-described. At the very least, it involves unnecessary steps. –  cfr Apr 25 at 22:06
Well cfr, the answer is 4 years old, so your mileage may vary and feel free to provide a better answer. Most of your comment does not provide any useful information for anybody. –  Christopher Oezbek Apr 29 at 6:03
Well it tells somebody running TeX Live that their system's failure to find initexmf is normal and does not mean their TeX installation is borked. It doesn't tell them what to do instead since that would take more than a comment. But it does tell them that they should look elsewhere for instructions. As I say, this command might have worked in past TeX Live installations or might be right for MiKTeX. But it isn't right for any relatively recent version of TeX Live. (In the strong sense that it isn't possible for relatively recent versions of TL.) –  cfr Apr 29 at 13:57
add comment

The easiest way is with XeTeX or LuaTeX and the fontspec package. They can use any TTF font installed on the system. For Linux this means both the system wide fonts and any fonts you put into ~/.fonts/ (e.g. by installing them via Nautilus).

To use the fonts you simply have to load the fontspec package and set the font:



Lorem ipsum...

Then compile the the document with xelatex or lualatex. The fontspec documentation describes all the possibilities for changing fonts.

The only drawbacks (as far as I am aware) are that you can only generate .pdf files and that you need a sufficiently new TeX distribution (TeX Live 2009 should work for XeTeX and Tex Live 2010 for LuaTeX).

share|improve this answer
I use XeTeX myself and think it's a good solution. There are some drawbacks, though, that may or may not be important to particular users. One of the major drawbacks for some is that the microtype package for XeTeX is not fully functional; microtype with pdftex gives much better results. –  Herbert Sitz Aug 22 '10 at 5:04
add comment

LuaTeX brings TTF-support, but I have no Idea how mature it is right now.

share|improve this answer
It works. And it's not too difficult to use in ConTeXt. But I'm not sure if anyone exposed this functionality to LaTeX already. –  Roman Plášil Aug 9 '10 at 7:17
The above example for xelatex (with fontspec + Arial) will work unchanged with lualatex too (with a recent fontspec). A discussion about difference of xelatex + lualatex is here tex.stackexchange.com/questions/3094/drawbacks-of-xetex-luatex –  Ulrike Fischer Oct 20 '10 at 7:45
add comment

Prepare for the world of pain.

See the same question I posted on superuser

share|improve this answer
Actually I think it might make more sense to duplicate the relevant information from SU here, since this site is supposed to become the LaTeX reference. –  David Z Jul 27 '10 at 1:40
Except that there's no relevant information on SU, beyond "I couldn't get it to work". :-) –  ShreevatsaR Jul 27 '10 at 1:48
Fair enough =) If anyone can point me to a recent guide on generating latex font metrics along with raster font for latex and ``fake" ttf fontmap for pdflatex I would highly appreciate it. –  Dima Jul 27 '10 at 1:53
@Dima If you insist on using a format that was created by a professor in Stanford for use in his books more than 30 years ago, you are asking for pain. The rest of the world simply uses ConTeXt or XeLaTeX/LuaLaTeX, where this just works. –  Martin Schröder Aug 24 '11 at 10:11
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.