Karakas Online

7.2.3. Using Type 1 Fonts

If you want a PDF document that not only excels when printed, but also when displayed on the screen, it is advisable to embed Type 1 fonts, even though the document may increase in size. The reason is is that by default TeX/LaTeX uses bitmapped fonts instead of Type1 or TrueType ones. The resolution of these bitmapped fonts matches that of the printer on the system you create the document. This is rarely the same resolution of the monitor or printer the reader will use. This change in resolution results in terrible quality when displaying these fonts on a screen. or printing it on a printer, whose resolution does not match the one of the bitmapped font.

The solution to the problem is to force TeX/LaTeX to use Type1 fonts which are scalable and thus resolution-independent. There are two ways to achieve this:

I chose the latter method. I like the look of the TeX documents that use Computer Modern fonts. cool

I am not alone with this predilection: most people use Computer Modern to start with, and even those relative sophisticates who use something as exotic as Sabon often find themselves using odd characters from CM without really intending to do so (see The wrong type of fonts in PDF).

Fortunately, rather good versions of the CM fonts are available from the AMS (who have them courtesy of Blue Sky Research and Y&Y, see Blue Sky Research and Computer Modern fonts for some historical background) and most modern systems have the fonts installed ready to use (if yours doesn't, go get them from the Comprehensive TeX Archive Network archives: Blue Sky CM Type 1 fonts, or any other CTAN mirror).

There are six DSSSL variables for defining parameters for changing fonts.

%title-font-family%

the font used for all titles. Example: titles, glossary entries.

%admon-font-family%

the font used for admonissions. Example: note.

%guilabel-font-family%

the font used for GUI text. Example: guimenuitem.

%mono-font-family%

the font used for elements needing typewriter or monospace text. Example: file names, commands and URLs.

%refentry-font-family%

the font used for references.

%body-font-family%

the font used for body text.

By default, these variables may take the following values:

Other font names may be used, but they correspond to one of the fonts in the list above. For example:

To use other fonts, they must be T1 fonts, the coding used by TeX. These are listed in the file called t1***.fd, where *** is the font code. The first letter represents the font provider; the next two letters represent the font name. In addition, we must ensure that all required files are present in our installation, i.e. the .tfm, .afm, .vf, .pfm and .pfb files for each .fd file.

We must ensure that Jadetex can associate the font name, e.g. Utopia, with the code name of the font (for Utopia, "put"). This is done by adding lines such as the following to the jadetex.cfg file:

\def\Family@font_name(***)

where *** again represents the three-letter code and "font_name" is the... font name. For example, to use the Utopia font, the following line would be added to the jadetex.cfg file:

\def\Family@Utopia{put}.

Following Customizing Document Production, we can include these lines in the jadetex.cfg file (currently commented, since they make sense only if you have those fonts installed - uncomment accordingly):

\makeatletter
\def\Family@Utopia{put}
\def\Family@ZapfChancery{pzc}
\def\Family@Fibonacci{cmfib}
\def\Family@Funny{cmfr}
\def\Family@Dunhill{cmdh}
\def\Family@Concrete{ccr}
\def\Family@Charter{bch}
\def\Family@Fontpxr{pxr}
\def\Family@Fontaer{aer}
\def\Family@Fontaess{aess}
\def\Family@Fontaett{aett}
\def\Family@Fontlcmss{lcmss}
\def\Family@Fontlcmtt{lcmtt}
\def\Family@Fontcmvtt{cmvtt}
\def\Family@Fontcmbr{cmbr}
\def\Family@Fontcmtl{cmtl}
\def\Family@Fontpxss{pxss}
\def\Family@Fonttxss{txss}
\def\Family@Fonttxr{txr}
\makeatother

The font declarations are preceded by \makeatletter and followed by \makeatother to properly escape the "@" symbol.

Now, if we wish titles to be formatted using Fonttxr and body text with Concrete, all that is necessary is to add the following lines to lyxtox-print-pdf.dsl:

(define %title-font-family% "Fonttxr") (define
%body-font-family% "Concrete"

And in order to use Computer Modern fonts in the PDF document , we write the following in the print stylesheet, lyxtox-print-pdf.dsl (see Section 7.1.5):

    ;;  Gnuishly correct fonts...
    ;;
    (define %body-font-family% "Computer-Modern")
    (define %mono-font-family% "Computer-Modern-Typewriter")
    (define %title-font-family% "Computer-Modern")
    (define %admon-font-family% "Computer-Modern-Sans")
    (define %guilabel-font-family% "Computer-Modern-Sans")

Now, if the T1 font encoding is used, i.e. if the jadetex.cfg file contains the line

\usepackage[T1]{fontenc}

the EC fonts will be used instead of the CM ones. Since there are no Type1 EC fonts available, pdftex will use bitmapped ones, yielding poor quality PDF files. Fortunately, there is a workaround: the ae package provides virtual EC fonts based on the CM ones, so that the Type1 CM fonts can be used in the output file. However, not all EC characters are available in this way. The aecompl package defines the missing characters as bitmapped fonts. To use them you should have the following in jadetex.cfg:

\usepackage{ae} 
\usepackage{aecompl} 

or just

\usepackage{ae,aecompl} 

In this way the output file will use CM fonts for all except some rarely used characters. pdfjadetex will end saying something like:

<8r.enc><cmex10.pfb><cmti9.pfb><cmmi6.pfb><cmr7.pfb><cmmi7.pfb> </var/cache/f
onts/pk/ljfour/jknappen/tc/tcrm0700.600pk><cmr6.pfb><cmsy10.pfb><cmitt10.pfb><c
mssi9.pfb><cmmi9.pfb><cmr9.pfb><cmmi10.pfb><cmtt8.pfb><cmtt9.pfb><cmss9.pfb> </
var/cache/fonts/pk/ljfour/jknappen/tc/tcrm0800.600pk><cmti10.pfb><cmbx10.pfb> <
/var/cache/fonts/pk/ljfour/jknappen/tc/tcrm1000.600pk><cmr10.pfb><cmssbx10.pfb>

meaning that it has embedded all fonts shown in angle brackets into the PDF file. See High quality PDF output from LaTeX and TeX for more details.

Tip Tip:
 

You can check the fonts used in the PDF file by choosing File-->Documet Info-->Fonts-->List all fonts in Acrobat® Reader. You will see that the fonts are embedded (not totally, but as a subset, which is the legally correct way) in the PDF document, see Figure 7-2.

Figure 7-2. Document Info: Fonts.

Document Info: Fonts.

Document Info: Fonts.

However, today other solutions to the font quality problem exist as well: instead of using virtual Type 1 fonts (which is what you do when you use the ae, aecompl and aeguill packages), you may choose to use “true” Type 1[1] fonts by installing one of the new CM-super, CM-LGC or Latin Modern fonts. From Finding 8-bit Type 1 fonts:

CM-super

is an auto-traced set which encompasses all of the T1 and TS1 encodings as well as the T2* series (the family of encodings that cover languages based on Cyrillic alphabets). These fonts are pretty easy to install (the installation instructions are clear), but they are huge: don't try to install them if you're short of disc space.

CM-LGC

is a similar "super-font" set, but of much more modest size; it covers T1, TS1 and T2{A} encodings (as does CM-super, and also covers the LGR encoding (for typesetting Greek, based on Claudio Beccari's Metafont sources). CM-LGC manages to be small by going to the opposite extreme from CM-super, which includes fonts at all the sizes supported by the original EC (a huge range); CM-LGC has one font per font shape, getting other sizes by scaling. There is an inevitable loss of quality inherent in this approach, but for the disc-space-challenged machine, CM-LGC is an obvious choice.

Latin Modern

is produced using a program MetaType1 which, as its name implies, brings the power of the Metafont paradigm to the production of Type 1 fonts. The Latin Modern set comes with T1, TS1 LY1 encoded variants (as well as a variant using the Polish QX encoding); for the glyph set it covers, its outlines seem rather cleaner than those of CM-super. Latin Modern is more modest in its disc space demands than is CM-super, while not being nearly as stark in its range of design sizes as is CM-LGC - Latin Modern's fonts are offered in the same set of sizes as the original CM fonts. It's hard to argue with the choice: Knuth's range of sizes has stood the test of time, and is one of the bases on which the excellence of the TeX system rests.

Notes

[1]

Not to be confused with “True Type” fonts.

Last updated Mon Sep 24 01:19:25 CEST 2007 Permalink: http://www.karakas-online.de/mySGML/explain-type-1.html All contents © 2002-2007 Chris Karakas