1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
\section{Magick::TypeMetric}
\scriptsize{
\begin{verbatim}
The TypeMetric 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.
The pixel units may be converted to points (the standard
resolution-independent measure used by the typesetting industry) via the
following equation:
size_points = (size_pixels * 72)/resolution
where resolution is in dots-per-inch (DPI). This means that at the default
image resolution, there is one pixel per point.
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.
See FreeType Glyph Conventions for a detailed description of font metrics
related issues.
The methods available in the TypeMetric class are shown in the following
table:
TypeMetric Methods
Method Returns Units Signature Description
Returns the distance in
pixels from the text
baseline to the
ascent double Pixels void highest/upper grid
coordinate used to place
an outline point. Always a
positive value.
Returns the the distance
in pixels from the
descent double Pixels void baseline to the lowest
grid coordinate used to
place an outline point.
Always a negative value.
textWidth double Pixels void Returns text width in
pixels.
textHeight double Pixels void Returns text height in
pixels.
Returns the maximum
horizontal advance
maxHorizontalAdvance double Pixels void (advance from the
beginning of a character
to the beginning of the
next character) in pixels.
\end{verbatim}
}
|