I know that if one wants to use true type fonts, there are solutions via xelatex or lualatex.

My question however is, why it is like so? What is the fundamental difference between latex fonts and ttf that dictates this behavior and how [xe/lua]latex overcome this problem?

  • The font model of pdftex is based on eight bit fonts, that is, the fonts only accommodate 256 glyphs. – egreg Apr 1 '14 at 7:47
  • 2
    it is the way how the metrics of the fonts are read. You can convert ttf/otf fonts for using with pdftex. See tex.stackexchange.com/questions/52819/… – user2478 Apr 1 '14 at 7:53
  • 1
    @Herbert You can use truetype fonts without conversion with pdfLaTeX provided you use virtual fonts to access them. You just can't use them with regular LaTeX. – cfr Apr 1 '14 at 9:42
  • 1
    @cfr: So you focus on PostScript? Because dvipdfmx works with Knuth-TeX. – Martin Schröder Apr 1 '14 at 16:07
  • 1
    @MartinSchröder It is not intended as a value-laden claim. 'Traditional TeX' in the '(more) traditional workflow' sense. But, really, I'm happy to specify what I mean using any reasonable description. Mine was probably not optimal. – cfr Apr 1 '14 at 17:27

Well pdflatex can handle true type fonts to a certain extent. E.g. the winfonts package allows to use arial.ttf and other truetype fonts in windows. The main difference between pdftex and the new engines xetex and luatex is not the font format but

  1. the existence of the tfm-file with the metric informations: When using pdftex the tfm-file must exist before the compilation but xetex and luatex can create the information on the fly from the actual font.

  2. The number of glyphs in a font. pdftex can handle only 256 glyphs per tfm. So if the font has more glyphs you must create more than one tfm (and perhaps virtual fonts and .enc-files).

Setting up a font for pdftex needs some time. With xetex and luatex you can normally use it within minutes.

  • No you must either reencode it (that means use something like " TeXBase1Encoding ReEncodeFont " <8r.enc <arial.ttf in the map file) or embed it completly (<<arial). – Ulrike Fischer Apr 1 '14 at 9:58
  • Ah, OK. That makes sense. I doubt I tried reencoding without using virtual fonts. Thanks. – cfr Apr 1 '14 at 10:00

LaTeX font system is really complicated. You can have some idea of why it's very difficult by looking source code of TeX font.

an example, droid package that provide droid font into LaTeX : http://www.ctan.org/tex-archive/fonts/droid

How fonts are used by TeX

Tex doesn't manipulate fonts, In the first implementation of tex compiler (no PdfLatex,Luatex,...) the tex compiler generates dvi files. This file is finally processes to generate pdf.

Tex only manages metrics. The main job of the tex compiler is putting boxes in the right place into a document. Moreother dviToPdf only manages T1 font (no ttf, no otf).

Moreover Tex only manages code pages that can contain 255 glyphs. (the T1 option of inputenc package specifying the right glyph page to load, some other ones exist depending of the language used).

What is the job of converting font for Tex format

Fortified by these previous explanations, I can explain the job of converting font.

  • First you must convert ttf font into T1 (really easy).
  • Second, You must wrote all Codepage translation. All glyphs are identified by their position into the font and a text ascii code that describe the right glyph. These codes are not normalized, and the job need to be done by human (that is the most part of the job)
  • Finally, you should generate by using metafont some font variation like sloping font

How to bypass theses limitation

Some alternate Tex compiler are able to manage ttf font. If you can, you should consider using these. Like LuaTeX or XeTeX.

More information

I say only a basic introduction of latex font compiling, For droid font the author has worked about 6 month on spare time to achieve this result.

  • I know that an article about font conversion has been written in tex releated magazine, but I don't fond the correct link – alexises Apr 1 '14 at 8:22
  • You don't need to use metafont or to write a Codepage translation. I don't even know what that is but I've written packages for both truetype and type1 fonts used in pdfTeX/TeX. (Truetype needs pdfTeX unless you convert to type1.) – cfr Apr 1 '14 at 9:46
  • 1
    And then there is dvipdfmx, which can handle TTF+OTF... – Martin Schröder Apr 1 '14 at 15:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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