14

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?

10
  • The font model of pdftex is based on eight bit fonts, that is, the fonts only accommodate 256 glyphs.
    – egreg
    Commented Apr 1, 2014 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
    Commented Apr 1, 2014 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
    Commented Apr 1, 2014 at 9:42
  • 1
    @cfr: So you focus on PostScript? Because dvipdfmx works with Knuth-TeX. Commented Apr 1, 2014 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
    Commented Apr 1, 2014 at 17:27

2 Answers 2

21

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.

2
  • 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). Commented Apr 1, 2014 at 9:58
  • Ah, OK. That makes sense. I doubt I tried reencoding without using virtual fonts. Thanks.
    – cfr
    Commented Apr 1, 2014 at 10:00
6

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.

3
  • I know that an article about font conversion has been written in tex releated magazine, but I don't fond the correct link
    – alexises
    Commented Apr 1, 2014 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
    Commented Apr 1, 2014 at 9:46
  • 1
    And then there is dvipdfmx, which can handle TTF+OTF... Commented Apr 1, 2014 at 15:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .