17.05.2014 Views

PDFlib 8 Windows COM/.NET Tutorial

PDFlib 8 Windows COM/.NET Tutorial

PDFlib 8 Windows COM/.NET Tutorial

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

5.5 Font Embedding and Subsetting<br />

5.5.1 Font Embedding<br />

PDF font embedding and font substitution in Acrobat. PDF documents can include<br />

font data in various formats to ensure proper text display. Alternatively, a font descriptor<br />

containing only the character metrics and some general font information (but not<br />

the actual glyph outlines) can be embedded. If a font is not embedded in a PDF document,<br />

Acrobat will take it from the target system if available and configured (»Use Local<br />

Fonts«), or try to build a substitute font according to the font descriptor. The use of substitution<br />

fonts results in readable text, but the glyphs may look different from the original<br />

font. More importantly, Acrobat’s substitution fonts (AdobeSansMM and AdobeSerif-<br />

MM) work only for Latin text, but not any other scripts or symbolic glyphs. Similarly,<br />

substitution fonts don’t work if complex script shaping or OpenType layout features<br />

have been used. For these reasons font embedding is generally recommended unless<br />

you know that the documents are displayed on the target systems acceptably even<br />

without embedded fonts. Such PDF files are inherently nonportable, but may be of use<br />

in controlled environments, such as corporate networks where the required fonts are<br />

known to be available on all workstations.<br />

Embedding fonts with <strong>PDFlib</strong>. Font embedding is controlled by the embedding option<br />

when loading a font (although in some cases <strong>PDFlib</strong> enforces font embedding):<br />

font = p.load_font("WarnockPro", "winansi", "embedding");<br />

Table 5.3 lists different situations with respect to font usage, each of which imposes different<br />

requirements on the font and metrics files required by <strong>PDFlib</strong>. In addition to the<br />

requirements listed in Table 5.3 the corresponding CMap files (plus in some cases the<br />

Unicode mapping CMap for the respective character collection, e.g. Adobe-Japan1-UCS2)<br />

must be available in order to use a (standard or custom) CJK font with any of the standard<br />

CMaps.<br />

Font embedding for fonts which are exclusively used for invisible text (mainly useful<br />

for OCR results) can be controlled with the optimizeinvisible option when loading the<br />

font.<br />

Table 5.2 Different font usage situations and required files<br />

font usage font metrics file required? font outline file required?<br />

one of the 14 core fonts no only if embedding=true<br />

TrueType, OpenType, or PostScript Type 1 host font installed<br />

on the Mac or <strong>Windows</strong> system<br />

no<br />

no<br />

non-core PostScript fonts yes only if embedding=true<br />

TrueType fonts n/a yes<br />

OpenType and SING fonts n/a yes<br />

standard CJK fonts 1<br />

no<br />

no<br />

1. See Section 6.5, »Chinese, Japanese, and Korean Text Output«, page 172, for more information on CJK fonts.<br />

142 Chapter 5: Font Handling (Edition for <strong>COM</strong>, .<strong>NET</strong>, and REALbasic)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!