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.

Long Distance Glider with sensational range!<br />

Using an image clipping path for placing text. As an alternative to manually constructing<br />

a path object with the path functions you can extract the clipping path from<br />

an image and place text on the resulting path. The image must have been loaded with<br />

the honorclippingpath option, and the clippingpathname option must also be supplied to<br />

load_image( ) if the target path is not the image’s default clipping path:<br />

image = p.load_image("auto", "image.tif", "clippingpathname={path 1}");<br />

/* create a path object from the image’s clipping path */<br />

path = (int) p.info_image(image, "clippingpath", "");<br />

if (path == -1)<br />

throw new Exception("Error: clipping path not found!");<br />

/* Place text on the path */<br />

p.fit_textline("Long Distance Glider with sensational range!", x, y,<br />

"textpath={path=" + path + "} position={center bottom}");<br />

Creating a gap between path and text. By default, <strong>PDFlib</strong> will place individual characters<br />

on the path, which means that there will no space between the glyphs and the path.<br />

If you want to create a gap between path and text you can simply increase the character<br />

boxes. This can easily be achieved with boxheight suboption of the matchbox option<br />

which specifies the vertical extension of the character boxes. The following option list<br />

takes the descenders into account (see Figure 8.10):<br />

p.fit_textline("Long Distance Glider with sensational range!", x, y,<br />

"textpath={path=" + path + "} position={center bottom} " +<br />

"matchbox={boxheight={capheight descender}}");<br />

Fig. 8.11<br />

Text on a path with an additional<br />

gap between text and path<br />

206 Chapter 8: Text and Table Formatting (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!