22.03.2015 Views

DLI Implementation and Reference Guide - Datalogics

DLI Implementation and Reference Guide - Datalogics

DLI Implementation and Reference Guide - Datalogics

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

Fonts 4.3<br />

CIDType0 Fonts<br />

CIDType0 fonts use the CMap file format as specified by Adobe, <strong>and</strong> will accept a number of different<br />

encodings, though these CMap files are typically somewhat narrow in their range of addressable<br />

characters. A CIDType0 font is usable with a set of CMap files; this is the only way to access characters.<br />

CIDType2 Fonts<br />

CIDType2 fonts are also TrueType font streams, but are addressed using 2-byte glyph identifiers (glyph<br />

IDs). These should not be created using CMaps, since the fonts are not keyed by character but by glyph.<br />

Instead, a CIDToGID map is used to convert the 2-byte character in the PDF text strings to glyph IDs for<br />

the font.<br />

For font files loaded into a DLPDFINSTANCE, <strong>DLI</strong> uses the International Components for Unicode (ICU)<br />

to translate Unicode inputs <strong>and</strong> a large array of vendor-defined multibyte encodings to output text. The<br />

DLPDFTEXT structure is used to properly combine characters <strong>and</strong> support right-to-left reading order. For<br />

CIDType2 fonts, a mapping from the DLPDFTEXT input to glyph IDs for output is generated. Whenever<br />

possible, the output text in the PDF file is in UTF16 big-endian format.<br />

The Adobe PDF Library <strong>and</strong> <strong>DLI</strong> also allow CIDType2 fonts to be used for a number of single-byte<br />

vendor encodings. Output is in two-byte glyph IDs which correspond to glyph identifiers in the embedded<br />

font stream. Text is input using the DLPDFCONTENT text calls as if using a single-byte font.<br />

Most TrueType <strong>and</strong> OpenType font files can be used to create either TrueType (single-byte) or CIDType2<br />

PDF fonts. In all cases, TrueType <strong>and</strong> CIDType2 fonts should be both embedded <strong>and</strong> subset to ensure<br />

reliable results when viewing <strong>and</strong> printing. In this chapter, the term "TrueType font" means a PDF<br />

TrueType font using a one-byte encoding, <strong>and</strong> the term "CIDType2 font" means a TrueType or OpenType<br />

font using GID values to access characters in the PDF file.<br />

Structure of a <strong>DLI</strong> Font<br />

A font is reflected in the structure DLPDFFONT. These structures are created by the font creation calls on a<br />

per-document basis. They may be used only within the document they were created with. Fonts are<br />

tracked within the document, <strong>and</strong> destroyed when the document is destroyed. Pointers to fonts are invalid<br />

after the destruction of their document. All DLPDFFONT structures for a given document will be released<br />

when that document is destroyed. Therefore, methods that use DLPDFFONT as a parameter (i.e.<br />

dlpdfcontenttext, dlpdfcontentwidetext, dlpdfcontenttextwidth,<br />

dlpdfcontentwidetextwidth) must be called before the document is destroyed

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

Saved successfully!

Ooh no, something went wrong!