PDFlib 8 Windows COM/.NET Tutorial
PDFlib 8 Windows COM/.NET Tutorial
PDFlib 8 Windows COM/.NET Tutorial
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
5.4.4 Searching for Fonts<br />
Sources of Font Data. As mentioned earlier, fonts can be loaded explicitly with the<br />
load_font( ) function or implicitly by supplying the fontname and encoding options to<br />
various text output functions. You can use a font’s native name or work with arbitrary<br />
custom names which will be used to locate the font data. Custom font names must be<br />
unique within a document. In info_font( ) this font name can be queried with the<br />
apiname key.<br />
Subsequent calls to load_font( ) will return the same font handle if all options are<br />
identical to those provided in the first call to this function (a few options are treated differently;<br />
see <strong>PDFlib</strong> API Reference for details). Otherwise a new font handle will be created<br />
for the same font name. <strong>PDFlib</strong> supports the following sources of font data:<br />
> Disk-based or virtual font files<br />
> Fonts pulled from the <strong>Windows</strong> or Mac operating system (host fonts)<br />
> PDF standard fonts: these are from a small set of Latin and CJK fonts with wellknown<br />
names<br />
> Type 3 fonts which have been defined with begin_font( ) and related functions.<br />
Cookbook A full code sample can be found in the Cookbook topic fonts/font_resources.<br />
Search order for fonts. The font name supplied to <strong>PDFlib</strong> is a name string. <strong>PDFlib</strong> uses<br />
the specified font name to search for fonts of various types in the following order. The<br />
search process stops as soon as one of the steps located a usable font:<br />
> The font name matches the name of a standard CJK font and the specified encoding<br />
is the name of a predefined CMap (see Section 6.5.1, »Standard CJK Fonts«, page 172).<br />
> The font name matches the name of a Type 3 font which has previously been created<br />
in the same document with begin_font( ) (see Section 5.1.5, »Type 3 Fonts«, page 119).<br />
> The font name matches the name in a FontOutline resource which connects the font<br />
name with the name of a TrueType or OpenType font file.<br />
> The font name matches the name in a FontAFM or FontPFM resource which connects<br />
the font name with the name of a PostScript Type 1 font metrics file.<br />
> The font name matches the name in a HostFont resource which connects the font<br />
name with the name of a font installed on the system.<br />
> The font name matches the name of a Latin core font (see »Latin core fonts«, page<br />
135).<br />
> The name matches the name of a host font installed on the system (see Section 5.4.5,<br />
»Host Fonts on <strong>Windows</strong> and Mac OS X«, page 137).<br />
> The font name matches the base name (i.e. without file name suffix) of a font file.<br />
If no font was found, font loading stops with the following error message:<br />
Font file (AFM, PFM, TTF, OTF etc.) or host font not found<br />
Details regarding the resource categories can be found in Section 3.1.3, »Resource Configuration<br />
and File Search«, page 62. The following sections discuss font loading for the<br />
various classes of fonts in more detail.<br />
132 Chapter 5: Font Handling (Edition for <strong>COM</strong>, .<strong>NET</strong>, and REALbasic)