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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

TrueType and OpenType fonts. The font name must be connected<br />

to the name of the desired font file via the FontOutline resource:<br />

p.set_parameter("FontOutline", "Arial=/usr/fonts/Arial.ttf");<br />

font = p.load_font("Arial", "unicode", "embedding");<br />

The alias font name to the left of the equal sign can be chosen arbitrarily:<br />

p.set_parameter("FontOutline", "f1=/usr/fonts/Arial.ttf");<br />

font = p.load_font("f1", "unicode", "embedding");<br />

As an alternative to runtime configuration via set_parameter( ), the FontOutline resource<br />

can be configured in a UPR file (see Section 3.1.3, »Resource Configuration and File<br />

Search«, page 62). In order to avoid absolute file names you can use the SearchPath resource<br />

category (again, the SearchPath resource category can alternatively be configured<br />

in a UPR file), for example:<br />

p.set_parameter("SearchPath", "/usr/fonts");<br />

p.set_parameter("FontOutline", "f1=Arial.ttf");<br />

font = p.load_font("f1", "unicode", "");<br />

TrueType Collections. In order to select a font which is contained in a True-<br />

Type Collection (TTC, see Section 6.5.2, »Custom CJK Fonts«, page 174) file you<br />

directly specify the name of the font:<br />

p.set_parameter("FontOutline", "MS-Gothic=msgothic.ttc");<br />

font = p.load_font("MS-Gothic", "unicode", "embedding");<br />

The font name will be matched against the names of all fonts in the TTC file. Alternatively,<br />

to select the n-th font in a TTC file you can specify the number n with a colon after<br />

the font name. In this case the alias font name to the left of the equal sign can be<br />

chosen arbitrarily:<br />

p.set_parameter("FontOutline", "f1=msgothic.ttc");<br />

font = p.load_font("f1:0", "unicode", "");<br />

PostScript Type 1 fonts. The font name must be connected to the name of<br />

the desired font metrics file via one of the FontAFM or FontPFM resource categories<br />

according to the type of the metrics file:<br />

p.set_parameter("FontPFM", "lucidux=LuciduxSans.pfm");<br />

font = p.load_font("lucidux", "unicode", "");<br />

If embedding is requested for a PostScript font, its name must be connected to the corresponding<br />

font outline file (PFA or PFB) via the FontOutline resource category:<br />

p.set_parameter("FontPFM", "lucidux=LuciduxSans.pfm");<br />

p.set_parameter("FontOutline", "lucidux=LuciduxSans.pfa");<br />

font = p.load_font("lucidux", "unicode", "embedding");<br />

Keep in mind that for PostScript Type 1 fonts the FontOutline resource alone is not sufficient.<br />

Since a metrics file is always required an AFM or PFM file must be available in order<br />

to load the font.<br />

The directories which will be searched for font metrics and outline files can be specified<br />

via the SearchPath resource category.<br />

5.4 Loading Fonts 133

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

Saved successfully!

Ooh no, something went wrong!