1<?xml version="1.0" encoding="utf-8" ?> 2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 4<head> 5<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 6<title>Magick++ API: Type Metrics</title> 7<link rel="stylesheet" href="magick.css" type="text/css" /> 8</head> 9<body> 10<div class="doc-section"> 11<h1 align="center">Magick::TypeMetric</h1> 12<p>The <i>TypeMetric</i> class provides the means to pass data from the Image class's TypeMetric method to the user. It provides information regarding font metrics such as ascent, descent, text width, text height, and maximum horizontal advance. The units of these font metrics are in pixels, and that the metrics are dependent on the current Image font (default Ghostscript's "Helvetica"), pointsize (default 12 points), and x/y resolution (default 72 DPI) settings.</p> 13<p>The pixel units may be converted to points (the standard resolution-independent measure used by the typesetting industry) via the following equation:</p> 14<pre class="text"> 15size_points = (size_pixels * 72)/resolution 16</pre> 17<p>where resolution is in dots-per-inch (DPI). This means that at the default image resolution, there is one pixel per point.</p> 18<p>Note that a font's pointsize is only a first-order approximation of the font height (ascender + descender) in points. The relationship between the specified pointsize and the rendered font height is determined by the font designer.</p> 19<p>See <a href="http://freetype.sourceforge.net/freetype2/docs/glyphs/index.html">FreeType Glyph Conventions</a> for a detailed description of font metrics related issues.</p> 20<p style="margin-bottom: 0cm">The methods available in the <i>TypeMetric</i> class are shown in the following table:</p> 21<p align="center" style="margin-bottom: 0cm"><b>TypeMetric Methods</b></p> 22<ul><table width="100%" border="1" cellpadding="2" cellspacing="2"> 23<tr> 24<td> 25<p align="center"><b>Method</b></p></td> 26<td> 27<p align="center"><b>Returns</b></p></td> 28<td> 29<p><b>Units</b></p></td> 30<td> 31<p align="center"><b>Signature</b></p></td> 32<td> 33<p align="center"><b>Description</b></p></td></tr> 34<tr> 35<td> 36<p align="center"><a name="ascent"></a><font size="2">ascent</font></p></td> 37<td> 38<p><font size="2">double</font></p></td> 39<td> 40<p><font size="2">Pixels</font></p></td> 41<td> 42<p><font size="2">void</font></p></td> 43<td> 44<p><font size="2">Returns the distance in pixels from the text baseline to the highest/upper grid coordinate used to place an outline point. Always a positive value.</font></p></td></tr> 45<tr> 46<td> 47<p align="center"><a name="descent"></a><font size="2">descent</font></p></td> 48<td> 49<p><font size="2">double</font></p></td> 50<td> 51<p><font size="2">Pixels</font></p></td> 52<td> 53<p><font size="2">void</font></p></td> 54<td> 55<p><font size="2">Returns the the distance in pixels from the baseline to the lowest grid coordinate used to place an outline point. Always a negative value.</font></p></td></tr> 56<tr> 57<td> 58<p align="center"><a name="textWidth"></a><font size="2">textWidth</font></p></td> 59<td> 60<p><font size="2">double</font></p></td> 61<td> 62<p><font size="2">Pixels</font></p></td> 63<td> 64<p><font size="2">void</font></p></td> 65<td> 66<p><font size="2">Returns text width in pixels.</font></p></td></tr> 67<tr> 68<td> 69<p align="center"><a name="textHeight"></a><font size="2">textHeight</font></p></td> 70<td> 71<p><font size="2">double</font></p></td> 72<td> 73<p><font size="2">Pixels</font></p></td> 74<td> 75<p><font size="2">void</font></p></td> 76<td> 77<p><font size="2">Returns text height in pixels.</font></p></td></tr> 78<tr> 79<td> 80<p align="center"><a name="maxHorizontalAdvance"></a><font size="2">maxHorizontalAdvance</font></p></td> 81<td> 82<p><font size="2">double</font></p></td> 83<td> 84<p><font size="2">Pixels</font></p></td> 85<td> 86<p><font size="2">void</font></p></td> 87<td> 88<p><font size="2">Returns the maximum horizontal advance (advance from the beginning of a character to the beginning of the next character) in pixels.</font></p></td></tr></table></ul> 89</div> 90</body> 91</html> 92