Hack 43 Embed and Subset Fonts to Your Advantage

 < Day Day Up > 

figs/moderate.gif figs/hack43.gif

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.

See which PDF fonts are embedded or subset in your PDF by opening the PDF in Acrobat or Reader and selecting File Document Properties . . . Fonts. Embedded fonts will describe themselves as Embedded, whereas unembedded fonts will not likewise for subset fonts.


4.13.1 Embedding Fonts into PDF

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.

Figure 4-13. Original fonts (top) approximated by Acrobat (bottom), when they are not embedded in the PDF and they are not available on the system
figs/pdfh_0413.gif

How well does Acrobat/Reader approximate fonts? Turn off Use Local Fonts in Reader or Acrobat to see how your unembedded fonts might appear on other computers. Acrobat 6: Advanced Use Local Fonts. Reader 6: Document Use Local Fonts. Acrobat 5: View Use Local Fonts. Or, just Ctrl-Shift-Y.


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.

4.13.2 The Base 14 Fonts

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.

If your document uses Helvetica and you want to be sure your PDF is displayed using Helvetica (and not Arial), double-check to make sure it gets embedded. Some Distiller profiles [Hack #38] automatically exclude all Base 14 fonts from embedding.


Figure 4-14 provides samples of the Base 14 fonts, along with samples of the Base 35 fonts.

Figure 4-14. The Base 35 fonts: a superset of the Base 14 fonts (left column)
figs/pdfh_0414.gif

4.13.3 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.

Table 4-6. Base 35 font families and common lookalikes that are reasonably safe to use without embedding

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.

Table 4-7. Base 35 font families you should embed

Font family name

Common lookalike

Zapf Dingbats

Monotype Sorts

Zapf Chancery

Monotype Corsiva


If the Base 35 fonts shown in Figure 4-14.

4.13.4 Configure Distiller Font Embedding

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.

Figure 4-15. Changing font settings using the Distiller Fonts tab
figs/pdfh_0415.gif

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.

Acrobat 6 enables you to remove embedded fonts from your PDF using its PDF Optimizer feature. Select Advanced PDF Optimizer . . . Fonts to select fonts for removal.


4.13.5 Configure Ghostscript Font Embedding

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.

4.13.6 Subset Embedded Fonts

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.

4.13.7 Configure Distiller Font Subsetting

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.

4.13.8 Configure Ghostscript Font Subsetting

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.

 < Day Day Up > 


PDF Hacks.
PDF Hacks: 100 Industrial-Strength Tips & Tools
ISBN: 0596006551
EAN: 2147483647
Year: N/A
Pages: 158
Authors: Sid Steward

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net