Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > 28b9e36e96ce34b2567ae5b47a27b2c5 > files > 689

python-qt4-doc-4.10.3-3.mga4.noarch.rpm

<?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">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <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&#160;<i>pd</i>)</li><li><div class="fn" /><b><a href="qfontmetricsf.html#QFontMetricsF-3">__init__</a></b> (<i>self</i>, QFontMetrics)</li><li><div class="fn" /><b><a href="qfontmetricsf.html#QFontMetricsF-4">__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" />float <b><a href="qfontmetricsf.html#averageCharWidth">averageCharWidth</a></b> (<i>self</i>)</li><li><div class="fn" />QRectF <b><a href="qfontmetricsf.html#boundingRect">boundingRect</a></b> (<i>self</i>, QChar)</li><li><div class="fn" />QRectF <b><a href="qfontmetricsf.html#boundingRect-2">boundingRect</a></b> (<i>self</i>, QString&#160;<i>string</i>)</li><li><div class="fn" />QRectF <b><a href="qfontmetricsf.html#boundingRect-3">boundingRect</a></b> (<i>self</i>, QRectF&#160;<i>rect</i>, int&#160;<i>flags</i>, QString&#160;<i>text</i>, int&#160;<i>tabStops</i>&#160;=&#160;0, list-of-int&#160;<i>tabArray</i>&#160;=&#160;0)</li><li><div class="fn" />QRectF <b><a href="qfontmetricsf.html#boundingRectChar">boundingRectChar</a></b> (<i>self</i>, QChar)</li><li><div class="fn" />float <b><a href="qfontmetricsf.html#descent">descent</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qfontmetricsf.html#elidedText">elidedText</a></b> (<i>self</i>, QString&#160;<i>text</i>, Qt.TextElideMode&#160;<i>mode</i>, float&#160;<i>width</i>, int&#160;<i>flags</i>&#160;=&#160;0)</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" />bool <b><a href="qfontmetricsf.html#inFontUcs4">inFontUcs4</a></b> (<i>self</i>, int&#160;<i>character</i>)</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&#160;<i>flags</i>, QString&#160;<i>text</i>, int&#160;<i>tabStops</i>&#160;=&#160;0, list-of-int&#160;<i>tabArray</i>&#160;=&#160;0)</li><li><div class="fn" />float <b><a href="qfontmetricsf.html#strikeOutPos">strikeOutPos</a></b> (<i>self</i>)</li><li><div class="fn" />QRectF <b><a href="qfontmetricsf.html#tightBoundingRect">tightBoundingRect</a></b> (<i>self</i>, QString&#160;<i>text</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>, QChar)</li><li><div class="fn" />float <b><a href="qfontmetricsf.html#width-2">width</a></b> (<i>self</i>, QString&#160;<i>string</i>)</li><li><div class="fn" />float <b><a href="qfontmetricsf.html#widthChar">widthChar</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&#160;<i>other</i>)</li><li><div class="fn" />bool <b><a href="qfontmetricsf.html#__ne__">__ne__</a></b> (<i>self</i>, QFontMetricsF&#160;<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. You can construct a QFontMetricsF object
with an existing <a href="qfont.html">QFont</a> to obtain metrics
for that font. If the font is changed later, the font metrics
object is <i>not</i> updated.</p>
<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 class="cpp">
 <span class="type"><a href="qfont.html">QFont</a></span> font(<span class="string">"times"</span><span class="operator">,</span> <span class="number">24</span>);
 <span class="type">QFontMetricsF</span> fm(font);
 <span class="type"><a href="qtcore.html#qreal-typedef">qreal</a></span> pixelsWide <span class="operator">=</span> fm<span class="operator">.</span><a href="qfontmetricsf.html#width">width</a>(<span class="string">"What's the width of this text?"</span>);
 <span class="type"><a href="qtcore.html#qreal-typedef">qreal</a></span> pixelsHigh <span class="operator">=</span> fm<span class="operator">.</span><a href="qfontmetricsf.html#height">height</a>();
</pre><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> &amp;, <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>&#160;<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="qfontmetrics.html">QFontMetrics</a>)</h3><p>Constructs a font metrics object with floating point precision
from the given <i>fontMetrics</i> object.</p>
<p>This function was introduced in Qt 4.2.</p>


<h3 class="fn"><a name="QFontMetricsF-4" />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><b>See also</b> <a href="qfontmetricsf.html#descent">descent</a>().</p>


<h3 class="fn"><a name="averageCharWidth" />float QFontMetricsF.averageCharWidth (<i>self</i>)</h3><p>Returns the average width of glyphs in the font.</p>
<p>This function was introduced in Qt 4.2.</p>


<h3 class="fn"><a name="boundingRect" /><a href="qrectf.html">QRectF</a> QFontMetricsF.boundingRect (<i>self</i>, QChar)</h3><p>Returns the bounding rectangle of the characters in the string
specified by <i>text</i>. The bounding rectangle always covers at
least 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 width of the returned
rectangle might be different than what the <a href="qfontmetricsf.html#width">width</a>() method returns.</p>
<p>If you want to know the advance width of the string (to layout a
set of strings next to each other), use <a href="qfontmetricsf.html#width">width</a>() instead.</p>
<p>Newline characters are processed as normal characters,
<i>not</i> as linebreaks.</p>
<p>The height of the bounding rectangle is at least as large as the
value returned <a href="qfontmetricsf.html#height">height</a>().</p>
<p><b>See also</b> <a href="qfontmetricsf.html#width">width</a>(),
<a href="qfontmetricsf.html#height">height</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>, QString&#160;<i>string</i>)</h3><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><b>See also</b> <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>&#160;<i>rect</i>, int&#160;<i>flags</i>, QString&#160;<i>text</i>, int&#160;<i>tabStops</i>&#160;=&#160;0, list-of-int&#160;<i>tabArray</i>&#160;=&#160;0)</h3><p>The <i>tabArray</i> argument may also be None.</p><p>This is an overloaded function.</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><a href="qt.html#TextFlag-enum">Qt.TextWordWrap</a> 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><b>See also</b> <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="boundingRectChar" /><a href="qrectf.html">QRectF</a> QFontMetricsF.boundingRectChar (<i>self</i>, QChar)</h3><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><b>See also</b> <a href="qfontmetricsf.html#ascent">ascent</a>().</p>


<h3 class="fn"><a name="elidedText" />QString QFontMetricsF.elidedText (<i>self</i>, QString&#160;<i>text</i>, <a href="qt.html#TextElideMode-enum">Qt.TextElideMode</a>&#160;<i>mode</i>, float&#160;<i>width</i>, int&#160;<i>flags</i>&#160;=&#160;0)</h3><p>If the string <i>text</i> is wider than <i>width</i>, returns an
elided version of the string (i.e., a string with "..." in it).
Otherwise, returns the original string.</p>
<p>The <i>mode</i> parameter specifies whether the text is elided
on the left (e.g., "...tech"), in the middle (e.g., "Tr...ch"), or
on the right (e.g., "Trol...").</p>
<p>The <i>width</i> is specified in pixels, not characters.</p>
<p>The <i>flags</i> argument is optional and currently only
supports <a href="qt.html#TextFlag-enum">Qt.TextShowMnemonic</a>
as value.</p>
<p>This function was introduced in Qt 4.2.</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><b>See also</b> <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>, QChar)</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="inFontUcs4" />bool QFontMetricsF.inFontUcs4 (<i>self</i>, int&#160;<i>character</i>)</h3><p>Returns true if the character given by <i>ch</i>, encoded in
UCS-4/UTF-32, is a valid character in the font; otherwise returns
false.</p>
<p>This function was introduced in Qt 4.8.</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><b>See also</b> <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>, QChar)</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><b>See also</b> <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><b>See also</b> <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><b>See also</b> <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><b>See also</b> <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><b>See also</b> <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><b>See also</b> <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>, QChar)</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><b>See also</b> <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&#160;<i>flags</i>, QString&#160;<i>text</i>, int&#160;<i>tabStops</i>&#160;=&#160;0, list-of-int&#160;<i>tabArray</i>&#160;=&#160;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 class="compat" 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><b>See also</b> <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><b>See also</b> <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="tightBoundingRect" /><a href="qrectf.html">QRectF</a> QFontMetricsF.tightBoundingRect (<i>self</i>, QString&#160;<i>text</i>)</h3><p>Returns a tight bounding rectangle around the characters in the
string specified by <i>text</i>. The bounding rectangle always
covers at least 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 width of the returned
rectangle might be different than what the <a href="qfontmetricsf.html#width">width</a>() method returns.</p>
<p>If you want to know the advance width of the string (to layout a
set of strings next to each other), use <a href="qfontmetricsf.html#width">width</a>() instead.</p>
<p>Newline characters are processed as normal characters,
<i>not</i> as linebreaks.</p>
<p><b>Warning:</b> Calling this method is very slow on Windows.</p>
<p>This function was introduced in Qt 4.3.</p>
<p><b>See also</b> <a href="qfontmetricsf.html#width">width</a>(),
<a href="qfontmetricsf.html#height">height</a>(), and <a href="qfontmetricsf.html#boundingRect">boundingRect</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><b>See also</b> <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>, QChar)</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><b>See also</b> <a href="qfontmetricsf.html#boundingRect">boundingRect</a>().</p>


<h3 class="fn"><a name="width-2" />float QFontMetricsF.width (<i>self</i>, QString&#160;<i>string</i>)</h3><p>This is an overloaded function.</p>
<p class="centerAlign"><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. When implementing
an interactive text control, use <a href="qtextlayout.html">QTextLayout</a> instead.</p>
<p><b>See also</b> <a href="qfontmetricsf.html#boundingRect">boundingRect</a>().</p>


<h3 class="fn"><a name="widthChar" />float QFontMetricsF.widthChar (<i>self</i>, QChar)</h3><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>&#160;<i>other</i>)</h3><h3 class="fn"><a name="__ne__" />bool QFontMetricsF.__ne__ (<i>self</i>, <a href="qfontmetricsf.html">QFontMetricsF</a>&#160;<i>other</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.10.3 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.5</td></tr></table></div></address></body></html>