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.

Cookbook A full code sample can be found in the Cookbook topic fonts/artificial_fontstyles.<br />

Simulated bold fonts. While fontstyle feature operates on a font, <strong>PDFlib</strong> supports an alternate<br />

mechanism for creating artificial bold text for individual text strings. This is<br />

controlled by the fakebold parameter or option.<br />

Cookbook A full code sample can be found in the Cookbook topic fonts/simulated_fontstyles.<br />

Simulated italic fonts. As an alternative to the fontstyle feature the italicangle parameter<br />

or option can be used to simulate italic fonts when only a regular font is available.<br />

This method creates a fake italic font by skewing the regular font by a user-provided angle,<br />

and does not suffer from the fontstyle restrictions mentioned above. Negative values<br />

will slant the text clockwise. Be warned that using a real italic or oblique font will result<br />

in much more pleasing output. However, if an italic font is not available the<br />

italicangle parameter or option can be used to easily simulate one. This feature may be<br />

especially useful for CJK fonts. Typical values for the italicangle parameter or option are<br />

in the range -12 to -15 degrees.<br />

Note The italicangle parameter or option is not supported for vertical writing mode.<br />

Note <strong>PDFlib</strong> does not adjust the glyph width to the new bounding box of the slanted glyph. For example,<br />

when generated justified text the italicized glyphs may exceed beyond the fitbox.<br />

Shadow text. <strong>PDFlib</strong> can create a shadow effect which will generate multiple instances<br />

of text where each instance is placed at a slightly different location. Shadow text can be<br />

created with the shadow option of fit_textline( ). The color of the shadow, its position relative<br />

to the main text and graphics state parameters can be specified in suboptions.<br />

Underline, overline, and strikeout text. <strong>PDFlib</strong> can be instructed to put lines below,<br />

above, or in the middle of text. The stroke width of the bar and its distance from the<br />

baseline are calculated based on the font’s metrics information. In addition, the current<br />

values of the horizontal scaling factor and the text matrix are taken into account when<br />

calculating the width of the bar. The respective parameter names for set_parameter( )<br />

can be used to switch the underline, overline, and strikeout feature on or off, as well as<br />

the corresponding options in the text output functions. The underlineposition and<br />

underlinewidth parameters and options can be used for fine-tuning.<br />

The current stroke color is used for drawing the bars. The current linecap parameter<br />

are ignored. The decorationabove option controls whether or not the line will be drawn<br />

on top of or below the text. Aesthetics alert: in most fonts underlining will touch descenders,<br />

and overlining will touch diacritical marks atop ascenders.<br />

Cookbook A full code sample can be found in the Cookbook topic text_output/starter_textline.<br />

Text rendering modes. <strong>PDFlib</strong> supports several rendering modes which affect the appearance<br />

of text. This includes outline text and the ability to use text as a clipping path.<br />

Text can also be rendered invisibly which may be useful for placing text on scanned images<br />

in order to make the text accessible to searching and indexing, while at the same<br />

time assuring it will not be visible directly. The rendering modes are described in the<br />

<strong>PDFlib</strong> API Reference, and can be set with the textrendering parameter or option.<br />

6.2 Font Metrics and Text Variations 155

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

Saved successfully!

Ooh no, something went wrong!