Sometimes it makes sense to embed fonts, while other times it just costs you space.
An embedded font is a font that has been packed into your PDF file as a resource. Embedding ensures that your PDF text looks perfect wherever it is printed or viewed. Embedding also bulks up your PDF's file size. In this hack we discuss embedding and its alternatives, their upsides and downsides. We also discuss font subsetting, which is the practice of embedding only a subset of the entire font. Subsetting was designed to reduce file size, but it can actually create bloat when misused.
|
For most purposes, all fonts should be embedded. If a font is not embedded in your PDF, Acrobat/Reader will try to find it on the computer. If the font isn't installed on the computer, Acrobat/Reader will try to approximate the font using its own resources, as shown in Figure 4-13. By not embedding a font, your PDF might end up looking slightly different on different machines.
|
The drawback to embedding is that each embedded font could add about 20 KB to your PDF file size. For some large PDFs this is negligible. For online PDFs of only a few pages, it can be unacceptable.
When PDF file size is critical, select some or all of your document fonts from one of the Base font collections and then configure Distiller to never embed them. The Base 14 fonts provide a solid core that is the safest to use without embedding. The Base 35 fonts provide traditional styles that are reasonably safe to use without embedding. For the fonts you must embed, prefer Type 1 fonts over TrueType fonts because embedded Type 1 fonts are much smaller.
The Base 14 fonts are utilitarian fonts that you can use safely in any PDF without embedding. Their family names are Times, Helvetica, Courier, and Symbol. Times New Roman commonly is used instead of Times, and Arial commonly is used instead of Helvetica.
|
Figure 4-14 provides samples of the Base 14 fonts, along with samples of the Base 35 fonts.
The Base 35 fonts are a superset of the Base 14 fonts. They add style, and most of them are reasonably safe to use without embedding. If your system does not have one of these font families, shown in Table 4-6, try using a lookalike font instead.
Font family name |
Common lookalike |
---|---|
Times |
Times New Roman |
Helvetica |
Arial |
Helvetica Narrow |
Arial Narrow |
Palatino |
Book Antiqua |
Bookman |
Bookman Old Style |
Avant Garde |
Century Gothic |
New Century Schoolbook |
Century Schoolbook |
Courier |
Courier New |
Symbol |
Symbol MT |
If you use the Base 35 fonts shown in Table 4-7, you should embed them. Any decorative or stylized font always should be embedded.
Font family name |
Common lookalike |
---|---|
Zapf Dingbats |
Monotype Sorts |
Zapf Chancery |
Monotype Corsiva |
If the Base 35 fonts shown in Figure 4-14.
The Fonts tab in your Distiller Job Options setting is the place to control font embedding, as shown in Figure 4-15. The Embed All Fonts checkbox sets the default policy. Unchecking it means Embed No Fonts. The Never Embed and Always Embed font lists are used to override the default policy on a font-by-font basis. So, if Embed All Fonts is checked, all document fonts get embedded in the PDF except those listed under Never Embed. If Embed All Fonts is unchecked, only the document fonts listed under Always Embed get embedded in the PDF.
Configure Distiller to never embed Base 14 fonts by putting them (and their lookalikes) on the Never Embed list. Give the Base 35 fonts (and their lookalikes) the same treatment if you desire. When using Acrobat/Distiller 5.0, the Base 14 fonts do not automatically include their lookalikes. On Windows, change the Font Source drop-down box to C:\windows\fonts or C:\winnt\fonts in order to see a list of your system fonts, which is where you'll find the lookalike fonts.
|
Ghostscript must embed all fonts except the Base 14 fonts. You can embed these, too, if you choose. Asking Ghostscript to withhold embedding of any other font could yield a PDF that doesn't work properly in Acrobat and Reader. Perhaps a future version of Ghostscript will resolve this issue.
It does not make sense to pack an entire font into a PDF when only a few characters from that font are actually used. Font subsetting is the technique of embedding only a portion of a font. A font subset contains only the characters used in your document. The alternative is to pack the entire font into the PDF. Distiller can entirely pack only Type 1 fonts into a PDF. Distiller subsets fonts in any other format (e.g., TrueType).
For most purposes, all embedded fonts should be subset. It only becomes an issue later, when assembling many PDF pieces into a single PDF. If each PDF piece uses embedded subset fonts, the resulting final document is in danger of having a single font represented by many unnecessary subsets. This can severely bloat the final document file size.
One solution to subset bloat is to use Acrobat 6 for assembling your document. After assembly, Save As . . . to a new PDF. Acrobat 6 works to consolidate the individual subsets into a single subset. Acrobat 5 does not do this. Another solution is to refry the PDF [Hack #60] after assembly.
If you plan to edit PDF text at the source-code level using a text editor, avoid subsetting the PDF fonts. If you add text to the PDF that uses characters not present in the font subset, your text will not display.
Distiller's Fonts tab is the place to control the subsetting of embedded fonts. To prevent Type 1 fonts from subsetting, uncheck the "Subset embedded fonts" checkbox. All other fonts (e.g., TrueType) are always subset.
To the right of this checkbox you can put a threshold for deciding which fonts get subset. If your document uses 95% of the characters in a font and you don't want that font subset, enter 94 into this field. Setting this to 100 means that every font will be subset.
To prevent Type 1 font subsetting, set /SubsetFonts false in your joboptions file or add -dSubsetFonts=false to your command line. If you desire font subsetting, set these to true instead of false.
To change the threshold for deciding which fonts get subset, set /MaxSubsetPct 100 in your joboptions file or add -dMaxSubsetPct=100 to your command line. Replace 100 with your desired setting.