<?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>QFontInfo 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="index.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">QFontInfo Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QFontInfo class provides general information about fonts. <a href="#details">More...</a></p> <h3>Methods</h3><ul><li><div class="fn" /><b><a href="qfontinfo.html#QFontInfo">__init__</a></b> (<i>self</i>, QFont)</li><li><div class="fn" /><b><a href="qfontinfo.html#QFontInfo-2">__init__</a></b> (<i>self</i>, QFontInfo)</li><li><div class="fn" />bool <b><a href="qfontinfo.html#bold">bold</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qfontinfo.html#exactMatch">exactMatch</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qfontinfo.html#family">family</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qfontinfo.html#fixedPitch">fixedPitch</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qfontinfo.html#italic">italic</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qfontinfo.html#pixelSize">pixelSize</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qfontinfo.html#pointSize">pointSize</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qfontinfo.html#pointSizeF">pointSizeF</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qfontinfo.html#rawMode">rawMode</a></b> (<i>self</i>)</li><li><div class="fn" />QFont.Style <b><a href="qfontinfo.html#style">style</a></b> (<i>self</i>)</li><li><div class="fn" />QFont.StyleHint <b><a href="qfontinfo.html#styleHint">styleHint</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qfontinfo.html#styleName">styleName</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qfontinfo.html#weight">weight</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QFontInfo class provides general information about fonts.</p> <p>The QFontInfo class provides the same access functions as <a href="qfont.html">QFont</a>, e.g. <a href="qfontinfo.html#family">family</a>(), <a href="qfontinfo.html#pointSize">pointSize</a>(), <a href="qfontinfo.html#italic">italic</a>(), <a href="qfontinfo.html#weight">weight</a>(), <a href="qfontinfo.html#fixedPitch">fixedPitch</a>(), <a href="qfontinfo.html#styleHint">styleHint</a>() etc. But whilst the <a href="qfont.html">QFont</a> access functions return the values that were set, a QFontInfo object returns the values that apply to the font that will actually be used to draw the text.</p> <p>For example, when the program asks for a 25pt Courier font on a machine that has a non-scalable 24pt Courier font, <a href="qfont.html">QFont</a> will (normally) use the 24pt Courier for rendering. In this case, <a href="qfont.html#pointSize">QFont.pointSize</a>() returns 25 and <a href="qfontinfo.html#pointSize">QFontInfo.pointSize</a>() returns 24.</p> <p>There are three ways to create a QFontInfo object.</p> <ol class="1"> <li>Calling the QFontInfo constructor with a <a href="qfont.html">QFont</a> creates a font info object for a screen-compatible font, i.e. the font cannot be a printer font. If the font is changed later, the font info 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#fontInfo">QWidget.fontInfo</a>() returns the font info for a widget's font. This is equivalent to calling QFontInfo(widget->font()). If the widget's font is changed later, the font info object is <i>not</i> updated.</li> <li><a href="qpainter.html#fontInfo">QPainter.fontInfo</a>() returns the font info for a painter's current font. If the painter's font is changed later, the font info object is <i>not</i> updated.</li> </ol> <hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QFontInfo" />QFontInfo.__init__ (<i>self</i>, <a href="qfont.html">QFont</a>)</h3><p>Constructs a font info object for <i>font</i>.</p> <p>The font must be screen-compatible, i.e. a font you use when drawing text in <a href="qwidget.html">widgets</a> or <a href="qpixmap.html">pixmaps</a>, not <a href="qpicture.html">QPicture</a> or <a href="qprinter.html">QPrinter</a>.</p> <p>The font info 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="qpainter.html#fontInfo">QPainter.fontInfo</a>() to get the font info when painting. This will give correct results also when painting on paint device that is not screen-compatible.</p> <h3 class="fn"><a name="QFontInfo-2" />QFontInfo.__init__ (<i>self</i>, <a href="qfontinfo.html">QFontInfo</a>)</h3><p>Constructs a copy of <i>fi</i>.</p> <h3 class="fn"><a name="bold" />bool QFontInfo.bold (<i>self</i>)</h3><p>Returns true if <a href="qfontinfo.html#weight">weight</a>() would return a value greater than <a href="qfont.html#Weight-enum">QFont.Normal</a>; otherwise returns false.</p> <p><b>See also</b> <a href="qfontinfo.html#weight">weight</a>() and <a href="qfont.html#bold">QFont.bold</a>().</p> <h3 class="fn"><a name="exactMatch" />bool QFontInfo.exactMatch (<i>self</i>)</h3><p>Returns true if the matched window system font is exactly the same as the one specified by the font; otherwise returns false.</p> <p><b>See also</b> <a href="qfont.html#exactMatch">QFont.exactMatch</a>().</p> <h3 class="fn"><a name="family" />QString QFontInfo.family (<i>self</i>)</h3><p>Returns the family name of the matched window system font.</p> <p><b>See also</b> <a href="qfont.html#family">QFont.family</a>().</p> <h3 class="fn"><a name="fixedPitch" />bool QFontInfo.fixedPitch (<i>self</i>)</h3><p>Returns the fixed pitch value of the matched window system font.</p> <p><b>See also</b> <a href="qfont.html#fixedPitch">QFont.fixedPitch</a>().</p> <h3 class="fn"><a name="italic" />bool QFontInfo.italic (<i>self</i>)</h3><p>Returns the italic value of the matched window system font.</p> <p><b>See also</b> <a href="qfont.html#italic">QFont.italic</a>().</p> <h3 class="fn"><a name="pixelSize" />int QFontInfo.pixelSize (<i>self</i>)</h3><p>Returns the pixel size of the matched window system font.</p> <p><b>See also</b> <a href="qfont.html#pointSize">QFont.pointSize</a>().</p> <h3 class="fn"><a name="pointSize" />int QFontInfo.pointSize (<i>self</i>)</h3><p>Returns the point size of the matched window system font.</p> <p><b>See also</b> <a href="qfontinfo.html#pointSizeF">pointSizeF</a>() and <a href="qfont.html#pointSize">QFont.pointSize</a>().</p> <h3 class="fn"><a name="pointSizeF" />float QFontInfo.pointSizeF (<i>self</i>)</h3><p>Returns the point size of the matched window system font.</p> <p><b>See also</b> <a href="qfont.html#pointSizeF">QFont.pointSizeF</a>().</p> <h3 class="fn"><a name="rawMode" />bool QFontInfo.rawMode (<i>self</i>)</h3><p>Returns true if the font is a raw mode font; otherwise returns false.</p> <p>If it is a raw mode font, all other functions in <a href="qfontinfo.html">QFontInfo</a> will return the same values set in the <a href="qfont.html">QFont</a>, regardless of the font actually used.</p> <p><b>See also</b> <a href="qfont.html#rawMode">QFont.rawMode</a>().</p> <h3 class="fn"><a name="style" /><a href="qfont.html#Style-enum">QFont.Style</a> QFontInfo.style (<i>self</i>)</h3><p>Returns the style value of the matched window system font.</p> <p><b>See also</b> <a href="qfont.html#style">QFont.style</a>().</p> <h3 class="fn"><a name="styleHint" /><a href="qfont.html#StyleHint-enum">QFont.StyleHint</a> QFontInfo.styleHint (<i>self</i>)</h3><p>Returns the style of the matched window system font.</p> <p>Currently only returns the style hint set in <a href="qfont.html">QFont</a>.</p> <p><b>See also</b> <a href="qfont.html#styleHint">QFont.styleHint</a>() and <a href="qfont.html#StyleHint-enum">QFont.StyleHint</a>.</p> <h3 class="fn"><a name="styleName" />QString QFontInfo.styleName (<i>self</i>)</h3><p>Returns the style name of the matched window system font on system that supports it.</p> <p>This function was introduced in Qt 4.8.</p> <p><b>See also</b> <a href="qfont.html#styleName">QFont.styleName</a>().</p> <h3 class="fn"><a name="weight" />int QFontInfo.weight (<i>self</i>)</h3><p>Returns the weight of the matched window system font.</p> <p><b>See also</b> <a href="qfont.html#weight">QFont.weight</a>() and <a href="qfontinfo.html#bold">bold</a>().</p> <address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.10.3 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt 4.8.5</td></tr></table></div></address></body></html>