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 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QFontMetricsF Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">  </td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QFontMetricsF Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QFontMetricsF class provides font metrics information. <a href="#details">More...</a></p>
<h3>Methods</h3><ul><li><div class="fn" /><b><a href="qfontmetricsf.html#QFontMetricsF">__init__</a></b> (<i>self</i>, QFont)</li><li><div class="fn" /><b><a href="qfontmetricsf.html#QFontMetricsF-2">__init__</a></b> (<i>self</i>, QFont, QPaintDevice <i>pd</i>)</li><li><div class="fn" /><b><a href="qfontmetricsf.html#QFontMetricsF-3">__init__</a></b> (<i>self</i>, QFontMetricsF)</li><li><div class="fn" />float <b><a href="qfontmetricsf.html#ascent">ascent</a></b> (<i>self</i>)</li><li><div class="fn" />QRectF <b><a href="qfontmetricsf.html#boundingRect">boundingRect</a></b> (<i>self</i>, QString <i>string</i>)</li><li><div class="fn" />QRectF <b><a href="qfontmetricsf.html#boundingRect-2">boundingRect</a></b> (<i>self</i>, QChar)</li><li><div class="fn" />QRectF <b><a href="qfontmetricsf.html#boundingRect-3">boundingRect</a></b> (<i>self</i>, QRectF <i>r</i>, int <i>flags</i>, QString <i>string</i>, int <i>tabstops</i> = 0, list <i>tabarray</i> = 0)</li><li><div class="fn" />float <b><a href="qfontmetricsf.html#descent">descent</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qfontmetricsf.html#height">height</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qfontmetricsf.html#inFont">inFont</a></b> (<i>self</i>, QChar)</li><li><div class="fn" />float <b><a href="qfontmetricsf.html#leading">leading</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qfontmetricsf.html#leftBearing">leftBearing</a></b> (<i>self</i>, QChar)</li><li><div class="fn" />float <b><a href="qfontmetricsf.html#lineSpacing">lineSpacing</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qfontmetricsf.html#lineWidth">lineWidth</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qfontmetricsf.html#maxWidth">maxWidth</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qfontmetricsf.html#minLeftBearing">minLeftBearing</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qfontmetricsf.html#minRightBearing">minRightBearing</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qfontmetricsf.html#overlinePos">overlinePos</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qfontmetricsf.html#rightBearing">rightBearing</a></b> (<i>self</i>, QChar)</li><li><div class="fn" />QSizeF <b><a href="qfontmetricsf.html#size">size</a></b> (<i>self</i>, int <i>flags</i>, QString <i>str</i>, int <i>tabstops</i> = 0, list <i>tabarray</i> = 0)</li><li><div class="fn" />float <b><a href="qfontmetricsf.html#strikeOutPos">strikeOutPos</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qfontmetricsf.html#underlinePos">underlinePos</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qfontmetricsf.html#width">width</a></b> (<i>self</i>, QString <i>string</i>)</li><li><div class="fn" />float <b><a href="qfontmetricsf.html#width-2">width</a></b> (<i>self</i>, QChar)</li><li><div class="fn" />float <b><a href="qfontmetricsf.html#xHeight">xHeight</a></b> (<i>self</i>)</li></ul><h3>Special Methods</h3><ul><li><div class="fn" />bool <b><a href="qfontmetricsf.html#__eq__">__eq__</a></b> (<i>self</i>, QFontMetricsF <i>other</i>)</li><li><div class="fn" />bool <b><a href="qfontmetricsf.html#__ne__">__ne__</a></b> (<i>self</i>, QFontMetricsF <i>other</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QFontMetricsF class provides font metrics information.</p>
<p>QFontMetricsF functions calculate the size of characters and strings for a given font. There are three ways you can create a QFontMetricsF object:</p>
<ol type="1">
<li>Calling the QFontMetricsF constructor with a <a href="qfont.html">QFont</a> creates a font metrics object for a screen-compatible font, i.e. the font cannot be a printer font. If the font is changed later, the font metrics object is <i>not</i> updated.
<p>(Note: If you use a printer font the values returned may be inaccurate. Printer fonts are not always accessible so the nearest screen font is used if a printer font is supplied.)</p>
</li>
<li><a href="qwidget.html#fontMetrics">QWidget.fontMetrics</a>() returns the font metrics for a widget's font. This is equivalent to QFontMetricsF(widget->font()). If the widget's font is changed later, the font metrics object is <i>not</i> updated.</li>
<li><a href="qpainter.html#fontMetrics">QPainter.fontMetrics</a>() returns the font metrics for a painter's current font. If the painter's font is changed later, the font metrics object is <i>not</i> updated.</li>
</ol>
<p>Once created, the object provides functions to access the individual metrics of the font, its characters, and for strings rendered in the font.</p>
<p>There are several functions that operate on the font: <a href="qfontmetricsf.html#ascent">ascent</a>(), <a href="qfontmetricsf.html#descent">descent</a>(), <a href="qfontmetricsf.html#height">height</a>(), <a href="qfontmetricsf.html#leading">leading</a>() and <a href="qfontmetricsf.html#lineSpacing">lineSpacing</a>() return the basic size properties of the font. The <a href="qfontmetricsf.html#underlinePos">underlinePos</a>(), <a href="qfontmetricsf.html#overlinePos">overlinePos</a>(), <a href="qfontmetricsf.html#strikeOutPos">strikeOutPos</a>() and <a href="qfontmetricsf.html#lineWidth">lineWidth</a>() functions, return the properties of the line that underlines, overlines or strikes out the characters. These functions are all fast.</p>
<p>There are also some functions that operate on the set of glyphs in the font: <a href="qfontmetricsf.html#minLeftBearing">minLeftBearing</a>(), <a href="qfontmetricsf.html#minRightBearing">minRightBearing</a>() and <a href="qfontmetricsf.html#maxWidth">maxWidth</a>(). These are by necessity slow, and we recommend avoiding them if possible.</p>
<p>For each character, you can get its <a href="qfontmetricsf.html#width">width</a>(), <a href="qfontmetricsf.html#leftBearing">leftBearing</a>() and <a href="qfontmetricsf.html#rightBearing">rightBearing</a>() and find out whether it is in the font using <a href="qfontmetricsf.html#inFont">inFont</a>(). You can also treat the character as a string, and use the string functions on it.</p>
<p>The string functions include <a href="qfontmetricsf.html#width">width</a>(), to return the width of a string in pixels (or points, for a printer), <a href="qfontmetricsf.html#boundingRect">boundingRect</a>(), to return a rectangle large enough to contain the rendered string, and <a href="qfontmetricsf.html#size">size</a>(), to return the size of that rectangle.</p>
<p>Example:</p>
<pre>
QFont font("times", 24);
QFontMetricsF fm(font);
int pixelsWide = fm.width("What's the width of this text?");
int pixelsHigh = fm.height();
</pre>
<p>See also <a href="qfont.html">QFont</a>, <a href="qfontinfo.html">QFontInfo</a>, and <a href="qfontdatabase.html">QFontDatabase</a>.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QFontMetricsF" />QFontMetricsF.__init__ (<i>self</i>, <a href="qfont.html">QFont</a>)</h3><p>Constructs a font metrics object for <i>font</i>.</p>
<p>The font metrics will be compatible with the paintdevice used to create <i>font</i>.</p>
<p>The font metrics object holds the information for the font that is passed in the constructor at the time it is created, and is not updated if the font's attributes are changed later.</p>
<p>Use <a href="qfontmetricsf.html">QFontMetricsF</a>(const <a href="qfont.html">QFont</a> &, <a href="qpaintdevice.html">QPaintDevice</a> *) to get the font metrics that are compatible with a certain paint device.</p>
<h3 class="fn"><a name="QFontMetricsF-2" />QFontMetricsF.__init__ (<i>self</i>, <a href="qfont.html">QFont</a>, <a href="qpaintdevice.html">QPaintDevice</a> <i>pd</i>)</h3><p>Constructs a font metrics object for <i>font</i> and <i>paintdevice</i>.</p>
<p>The font metrics will be compatible with the paintdevice passed. If the <i>paintdevice</i> is 0, the metrics will be screen-compatible, ie. the metrics you get if you use the font for drawing text on a <a href="qwidget.html">widgets</a> or <a href="qpixmap.html">pixmaps</a>, not on a <a href="qpicture.html">QPicture</a> or <a href="qprinter.html">QPrinter</a>.</p>
<p>The font metrics object holds the information for the font that is passed in the constructor at the time it is created, and is not updated if the font's attributes are changed later.</p>
<h3 class="fn"><a name="QFontMetricsF-3" />QFontMetricsF.__init__ (<i>self</i>, <a href="qfontmetricsf.html">QFontMetricsF</a>)</h3><p>Constructs a copy of <i>fm</i>.</p>
<h3 class="fn"><a name="ascent" />float QFontMetricsF.ascent (<i>self</i>)</h3><p>Returns the ascent of the font.</p>
<p>The ascent of a font is the distance from the baseline to the highest position characters extend to. In practice, some font designers break this rule, e.g. when they put more than one accent on top of a character, or to accommodate an unusual character in an exotic language, so it is possible (though rare) that this value will be too small.</p>
<p>See also <a href="qfontmetricsf.html#descent">descent</a>().</p>
<h3 class="fn"><a name="boundingRect" /><a href="qrectf.html">QRectF</a> QFontMetricsF.boundingRect (<i>self</i>, <a href="qstring.html">QString</a> <i>string</i>)</h3><p>Returns the bounding rectangle of the characters in the given <i>text</i>. This is the set of pixels the text would cover if drawn at (0, 0).</p>
<p>Note that the bounding rectangle may extend to the left of (0, 0), e.g. for italicized fonts, and that the text output may cover <i>all</i> pixels in the bounding rectangle.</p>
<p>Newline characters are processed as normal characters, <i>not</i> as line breaks.</p>
<p>Due to the different actual character heights, the height of the bounding rectangle of e.g. "Yes" and "yes" may be different.</p>
<p>See also <a href="qfontmetricsf.html#width">width</a>() and <a href="qpainter.html#boundingRect">QPainter.boundingRect</a>().</p>
<h3 class="fn"><a name="boundingRect-2" /><a href="qrectf.html">QRectF</a> QFontMetricsF.boundingRect (<i>self</i>, <a href="qchar.html">QChar</a>)</h3><p>This is an overloaded member function, provided for convenience.</p>
<p>Returns the bounding rectangle of the character <i>ch</i> relative to the left-most point on the base line.</p>
<p>Note that the bounding rectangle may extend to the left of (0, 0), e.g. for italicized fonts, and that the text output may cover <i>all</i> pixels in the bounding rectangle.</p>
<p>Note that the rectangle usually extends both above and below the base line.</p>
<p>See also <a href="qfontmetricsf.html#width">width</a>().</p>
<h3 class="fn"><a name="boundingRect-3" /><a href="qrectf.html">QRectF</a> QFontMetricsF.boundingRect (<i>self</i>, <a href="qrectf.html">QRectF</a> <i>r</i>, int <i>flags</i>, <a href="qstring.html">QString</a> <i>string</i>, int <i>tabstops</i> = 0, list <i>tabarray</i> = 0)</h3><p>The <i>tabarray</i> argument may also be None.</p><p>This is an overloaded member function, provided for convenience.</p>
<p>Returns the bounding rectangle of the characters in the given <i>text</i>. This is the set of pixels the text would cover if drawn when constrained to the bounding rectangle specified by <i>rect</i>.</p>
<p>The <i>flags</i> argument is the bitwise OR of the following flags:</p>
<ul>
<li><a href="qt.html#AlignmentFlag-enum">Qt.AlignLeft</a> aligns to the left border, except for Arabic and Hebrew where it aligns to the right.</li>
<li><a href="qt.html#AlignmentFlag-enum">Qt.AlignRight</a> aligns to the right border, except for Arabic and Hebrew where it aligns to the left.</li>
<li><a href="qt.html#AlignmentFlag-enum">Qt.AlignJustify</a> produces justified text.</li>
<li><a href="qt.html#AlignmentFlag-enum">Qt.AlignHCenter</a> aligns horizontally centered.</li>
<li><a href="qt.html#AlignmentFlag-enum">Qt.AlignTop</a> aligns to the top border.</li>
<li><a href="qt.html#AlignmentFlag-enum">Qt.AlignBottom</a> aligns to the bottom border.</li>
<li><a href="qt.html#AlignmentFlag-enum">Qt.AlignVCenter</a> aligns vertically centered</li>
<li><a href="qt.html#AlignmentFlag-enum">Qt.AlignCenter</a> (== <tt>Qt.AlignHCenter | Qt.AlignVCenter</tt>)</li>
<li><a href="qt.html#TextFlag-enum">Qt.TextSingleLine</a> ignores newline characters in the text.</li>
<li><a href="qt.html#TextFlag-enum">Qt.TextExpandTabs</a> expands tabs (see below)</li>
<li><a href="qt.html#TextFlag-enum">Qt.TextShowMnemonic</a> interprets "&amp;x" as <u>x</u>, i.e. underlined.</li>
<li>Qt.TextWordBreak breaks the text to fit the rectangle.</li>
</ul>
<p><a href="qt.html#Orientation-enum">Qt.Horizontal</a> alignment defaults to <a href="qt.html#AlignmentFlag-enum">Qt.AlignLeft</a> and vertical alignment defaults to <a href="qt.html#AlignmentFlag-enum">Qt.AlignTop</a>.</p>
<p>If several of the horizontal or several of the vertical alignment flags are set, the resulting alignment is undefined.</p>
<p>These flags are defined in <a href="qt.html#AlignmentFlag-enum">Qt.AlignmentFlag</a>.</p>
<p>If <a href="qt.html#TextFlag-enum">Qt.TextExpandTabs</a> is set in <i>flags</i>, the following behavior is used to interpret tab characters in the text:</p>
<ul>
<li>If <i>tabarray</i> is non-null, it specifies a 0-terminated sequence of pixel-positions for tabs in the text.</li>
<li>If <i>tabstops</i> is non-zero, it is used as the tab spacing (in pixels).</li>
</ul>
<p>Note that the bounding rectangle may extend to the left of (0, 0), e.g. for italicized fonts.</p>
<p>Newline characters are processed as line breaks.</p>
<p>Despite the different actual character heights, the heights of the bounding rectangles of "Yes" and "yes" are the same.</p>
<p>The bounding rectangle returned by this function is somewhat larger than that calculated by the simpler <a href="qfontmetricsf.html#boundingRect">boundingRect</a>() function. This function uses the <a href="qfontmetricsf.html#minLeftBearing">maximum left</a> and <a href="qfontmetricsf.html#minRightBearing">right</a> font bearings as is necessary for multi-line text to align correctly. Also, fontHeight() and <a href="qfontmetricsf.html#lineSpacing">lineSpacing</a>() are used to calculate the height, rather than individual character heights.</p>
<p>See also <a href="qfontmetricsf.html#width">width</a>(), <a href="qpainter.html#boundingRect">QPainter.boundingRect</a>(), and <a href="qt.html#AlignmentFlag-enum">Qt.Alignment</a>.</p>
<h3 class="fn"><a name="descent" />float QFontMetricsF.descent (<i>self</i>)</h3><p>Returns the descent of the font.</p>
<p>The descent is the distance from the base line to the lowest point characters extend to. (Note that this is different from X, which adds 1 pixel.) In practice, some font designers break this rule, e.g. to accommodate an unusual character in an exotic language, so it is possible (though rare) that this value will be too small.</p>
<p>See also <a href="qfontmetricsf.html#ascent">ascent</a>().</p>
<h3 class="fn"><a name="height" />float QFontMetricsF.height (<i>self</i>)</h3><p>Returns the height of the font.</p>
<p>This is always equal to <a href="qfontmetricsf.html#ascent">ascent</a>()+<a href="qfontmetricsf.html#descent">descent</a>()+1 (the 1 is for the base line).</p>
<p>See also <a href="qfontmetricsf.html#leading">leading</a>() and <a href="qfontmetricsf.html#lineSpacing">lineSpacing</a>().</p>
<h3 class="fn"><a name="inFont" />bool QFontMetricsF.inFont (<i>self</i>, <a href="qchar.html">QChar</a>)</h3><p>Returns true if character <i>ch</i> is a valid character in the font; otherwise returns false.</p>
<h3 class="fn"><a name="leading" />float QFontMetricsF.leading (<i>self</i>)</h3><p>Returns the leading of the font.</p>
<p>This is the natural inter-line spacing.</p>
<p>See also <a href="qfontmetricsf.html#height">height</a>() and <a href="qfontmetricsf.html#lineSpacing">lineSpacing</a>().</p>
<h3 class="fn"><a name="leftBearing" />float QFontMetricsF.leftBearing (<i>self</i>, <a href="qchar.html">QChar</a>)</h3><p>Returns the left bearing of character <i>ch</i> in the font.</p>
<p>The left bearing is the right-ward distance of the left-most pixel of the character from the logical origin of the character. This value is negative if the pixels of the character extend to the left of the logical origin.</p>
<p>See width(<a href="qchar.html">QChar</a>) for a graphical description of this metric.</p>
<p>See also <a href="qfontmetricsf.html#rightBearing">rightBearing</a>(), <a href="qfontmetricsf.html#minLeftBearing">minLeftBearing</a>(), and <a href="qfontmetricsf.html#width">width</a>().</p>
<h3 class="fn"><a name="lineSpacing" />float QFontMetricsF.lineSpacing (<i>self</i>)</h3><p>Returns the distance from one base line to the next.</p>
<p>This value is always equal to <a href="qfontmetricsf.html#leading">leading</a>()+<a href="qfontmetricsf.html#height">height</a>().</p>
<p>See also <a href="qfontmetricsf.html#height">height</a>() and <a href="qfontmetricsf.html#leading">leading</a>().</p>
<h3 class="fn"><a name="lineWidth" />float QFontMetricsF.lineWidth (<i>self</i>)</h3><p>Returns the width of the underline and strikeout lines, adjusted for the point size of the font.</p>
<p>See also <a href="qfontmetricsf.html#underlinePos">underlinePos</a>(), <a href="qfontmetricsf.html#overlinePos">overlinePos</a>(), and <a href="qfontmetricsf.html#strikeOutPos">strikeOutPos</a>().</p>
<h3 class="fn"><a name="maxWidth" />float QFontMetricsF.maxWidth (<i>self</i>)</h3><p>Returns the width of the widest character in the font.</p>
<h3 class="fn"><a name="minLeftBearing" />float QFontMetricsF.minLeftBearing (<i>self</i>)</h3><p>Returns the minimum left bearing of the font.</p>
<p>This is the smallest leftBearing(char) of all characters in the font.</p>
<p>Note that this function can be very slow if the font is large.</p>
<p>See also <a href="qfontmetricsf.html#minRightBearing">minRightBearing</a>() and <a href="qfontmetricsf.html#leftBearing">leftBearing</a>().</p>
<h3 class="fn"><a name="minRightBearing" />float QFontMetricsF.minRightBearing (<i>self</i>)</h3><p>Returns the minimum right bearing of the font.</p>
<p>This is the smallest rightBearing(char) of all characters in the font.</p>
<p>Note that this function can be very slow if the font is large.</p>
<p>See also <a href="qfontmetricsf.html#minLeftBearing">minLeftBearing</a>() and <a href="qfontmetricsf.html#rightBearing">rightBearing</a>().</p>
<h3 class="fn"><a name="overlinePos" />float QFontMetricsF.overlinePos (<i>self</i>)</h3><p>Returns the distance from the base line to where an overline should be drawn.</p>
<p>See also <a href="qfontmetricsf.html#underlinePos">underlinePos</a>(), <a href="qfontmetricsf.html#strikeOutPos">strikeOutPos</a>(), and <a href="qfontmetricsf.html#lineWidth">lineWidth</a>().</p>
<h3 class="fn"><a name="rightBearing" />float QFontMetricsF.rightBearing (<i>self</i>, <a href="qchar.html">QChar</a>)</h3><p>Returns the right bearing of character <i>ch</i> in the font.</p>
<p>The right bearing is the left-ward distance of the right-most pixel of the character from the logical origin of a subsequent character. This value is negative if the pixels of the character extend to the right of the <a href="qfontmetricsf.html#width">width</a>() of the character.</p>
<p>See <a href="qfontmetricsf.html#width">width</a>() for a graphical description of this metric.</p>
<p>See also <a href="qfontmetricsf.html#leftBearing">leftBearing</a>(), <a href="qfontmetricsf.html#minRightBearing">minRightBearing</a>(), and <a href="qfontmetricsf.html#width">width</a>().</p>
<h3 class="fn"><a name="size" /><a href="qsizef.html">QSizeF</a> QFontMetricsF.size (<i>self</i>, int <i>flags</i>, <a href="qstring.html">QString</a> <i>str</i>, int <i>tabstops</i> = 0, list <i>tabarray</i> = 0)</h3><p>The <i>tabarray</i> argument may also be None.</p><p>Returns the size in pixels of the characters in the given <i>text</i>.</p>
<p>The <i>flags</i> argument is the bitwise OR of the following flags:</p>
<ul>
<li><a href="qt.html#TextFlag-enum">Qt.TextSingleLine</a> ignores newline characters.</li>
<li><a href="qt.html#TextFlag-enum">Qt.TextExpandTabs</a> expands tabs (see below)</li>
<li><a href="qt.html#TextFlag-enum">Qt.TextShowMnemonic</a> interprets "&amp;x" as <u>x</u>, i.e. underlined.</li>
<li>Qt.TextWordBreak breaks the text to fit the rectangle.</li>
</ul>
<p>These flags are defined in <a href="qt-qt3.html#TextFlags-typedef">Qt.TextFlags</a>.</p>
<p>If <a href="qt.html#TextFlag-enum">Qt.TextExpandTabs</a> is set in <i>flags</i>, the following behavior is used to interpret tab characters in the text:</p>
<ul>
<li>If <i>tabarray</i> is non-null, it specifies a 0-terminated sequence of pixel-positions for tabs in the text.</li>
<li>If <i>tabstops</i> is non-zero, it is used as the tab spacing (in pixels).</li>
</ul>
<p>Newline characters are processed as line breaks.</p>
<p>Note: Despite the different actual character heights, the heights of the bounding rectangles of "Yes" and "yes" are the same.</p>
<p>See also <a href="qfontmetricsf.html#boundingRect">boundingRect</a>().</p>
<h3 class="fn"><a name="strikeOutPos" />float QFontMetricsF.strikeOutPos (<i>self</i>)</h3><p>Returns the distance from the base line to where the strikeout line should be drawn.</p>
<p>See also <a href="qfontmetricsf.html#underlinePos">underlinePos</a>(), <a href="qfontmetricsf.html#overlinePos">overlinePos</a>(), and <a href="qfontmetricsf.html#lineWidth">lineWidth</a>().</p>
<h3 class="fn"><a name="underlinePos" />float QFontMetricsF.underlinePos (<i>self</i>)</h3><p>Returns the distance from the base line to where an underscore should be drawn.</p>
<p>See also <a href="qfontmetricsf.html#overlinePos">overlinePos</a>(), <a href="qfontmetricsf.html#strikeOutPos">strikeOutPos</a>(), and <a href="qfontmetricsf.html#lineWidth">lineWidth</a>().</p>
<h3 class="fn"><a name="width" />float QFontMetricsF.width (<i>self</i>, <a href="qstring.html">QString</a> <i>string</i>)</h3><p>Returns the width in pixels of the characters in the given <i>text</i>.</p>
<p>Note that this value is <i>not</i> equal to the width returned by <a href="qfontmetricsf.html#boundingRect">boundingRect</a>().width() because <a href="qfontmetricsf.html#boundingRect">boundingRect</a>() returns a rectangle describing the pixels this string will cover whereas width() returns the distance to where the next string should be drawn.</p>
<p>See also <a href="qfontmetricsf.html#boundingRect">boundingRect</a>().</p>
<h3 class="fn"><a name="width-2" />float QFontMetricsF.width (<i>self</i>, <a href="qchar.html">QChar</a>)</h3><p>This is an overloaded member function, provided for convenience.</p>
<p align="center"><img alt="Bearings" src="images/bearings.png" /></p>
<p>Returns the logical width of character <i>ch</i> in pixels. This is a distance appropriate for drawing a subsequent character after <i>ch</i>.</p>
<p>Some of the metrics are described in the image to the right. The central dark rectangles cover the logical <a href="qfontmetricsf.html#width">width</a>() of each character. The outer pale rectangles cover the <a href="qfontmetricsf.html#leftBearing">leftBearing</a>() and <a href="qfontmetricsf.html#rightBearing">rightBearing</a>() of each character. Notice that the bearings of "f" in this particular font are both negative, while the bearings of "o" are both positive.</p>
<p><b>Warning:</b> This function will produce incorrect results for Arabic characters or non-spacing marks in the middle of a string, as the glyph shaping and positioning of marks that happens when processing strings cannot be taken into account. Use charWidth() instead if you aren't looking for the width of isolated characters.</p>
<p>See also <a href="qfontmetricsf.html#boundingRect">boundingRect</a>().</p>
<h3 class="fn"><a name="xHeight" />float QFontMetricsF.xHeight (<i>self</i>)</h3><p>Returns the 'x' height of the font. This is often but not always the same as the height of the character 'x'.</p>
<h3 class="fn"><a name="__eq__" />bool QFontMetricsF.__eq__ (<i>self</i>, <a href="qfontmetricsf.html">QFontMetricsF</a> <i>other</i>)</h3><h3 class="fn"><a name="__ne__" />bool QFontMetricsF.__ne__ (<i>self</i>, <a href="qfontmetricsf.html">QFontMetricsF</a> <i>other</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td width="25%">PyQt 4.0.1 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.trolltech.com">Trolltech AS</a> 2006</td><td align="right" width="25%">Qt 4.1.4</td></tr></table></div></address></body></html>
|