10.07.2015 Views

Download - Multivac!

Download - Multivac!

Download - Multivac!

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.

descender = p.info_font(font, "descender", "");xheight = p.info_font(font, "xheight", "");Note The position and size of superscript and subscript cannot be queried from PDFlib.Cookbook A full code sample can be found in the Cookbook topic fonts/font_metrics_info.CPI calculations. While most fonts have varying character widths, so-called monospacedfonts use the same widths for all characters. In order to relate PDF font metrics tothe characters per inch (CPI) measurements often used in high-speed print environments,some calculation examples for the mono-spaced Courier font may be helpful. InCourier, all characters have a width of 600 units with respect to the full character cell of1000 units per point (this value can be retrieved from the corresponding AFM metricsfile). For example, with 12 point text all characters will have an absolute width of12 points * 600/1000 = 7.2 pointswith an optimal line spacing of 12 points. Since there are 72 points to an inch, exactly 10characters of Courier 12 point will fit in an inch. In other words, 12 point Courier is a 10cpi font. For 10 point text, the character width is 6 points, resulting in a 72/6 = 12 cpifont. Similarly, 8 point Courier results in 15 cpi.5.5.2 KerningSome character combinations can lead to unpleasant appearance. For example, two Vsnext to each other can look like a W, and the distance between T and e must be reducedin order to avoid ugly white space. This compensation is referred to as kerning. Manyfonts contain comprehensive kerning tables which contain spacing adjustment valuesfor certain critical letter pairs. There are two PDFlib controls for the kerning behavior:> By default, kerning information in a font is not read when loading a font. If kerningis desired the kerning option must be set in the respective call to PDF_load_font( ).This instructs PDFlib to read the font’s kerning data (if available).> When a font for which kerning data has been read is used with any text output function,the positional corrections provided by the kerning data will be applied. However,kerning can also be disabled by setting the kerning parameter to false:p.set_parameter("kerning", "false"); /* disable kerning */Fig. 5.2 KerningNo kerningKerning appliedCharacter movement caused by kerning5.5 Font Metrics and Text Variations 113

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

Saved successfully!

Ooh no, something went wrong!