<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qfont.cpp:2590 --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>QFontInfo Class</title> <style type="text/css"><!-- fn { margin-left: 1cm; text-indent: -1cm; } a:link { color: #004faf; text-decoration: none } a:visited { color: #672967; text-decoration: none } body { background: #ffffff; color: black; } --></style> </head> <body> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr bgcolor="#E5E5E5"> <td 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="mainclasses.html"> <font color="#004faf">Main Classes</font></a> | <a href="annotated.html"> <font color="#004faf">Annotated</font></a> | <a href="groups.html"> <font color="#004faf">Grouped Classes</font></a> | <a href="functions.html"> <font color="#004faf">Functions</font></a> </td> <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QFontInfo Class Reference</h1> <p>The QFontInfo class provides general information about fonts. <a href="#details">More...</a> <p><tt>#include <<a href="qfontinfo-h.html">qfontinfo.h</a>></tt> <p><a href="qfontinfo-members.html">List of all member functions.</a> <h2>Public Members</h2> <ul> <li class=fn><a href="#QFontInfo"><b>QFontInfo</b></a> ( const QFont & font )</li> <li class=fn><a href="#QFontInfo-2"><b>QFontInfo</b></a> ( const QFont & font, QFont::Script script )</li> <li class=fn><a href="#QFontInfo-3"><b>QFontInfo</b></a> ( const QFontInfo & fi )</li> <li class=fn><a href="#~QFontInfo"><b>~QFontInfo</b></a> ()</li> <li class=fn>QFontInfo & <a href="#operator-eq"><b>operator=</b></a> ( const QFontInfo & fi )</li> <li class=fn>QString <a href="#family"><b>family</b></a> () const</li> <li class=fn>int <a href="#pixelSize"><b>pixelSize</b></a> () const</li> <li class=fn>int <a href="#pointSize"><b>pointSize</b></a> () const</li> <li class=fn>bool <a href="#italic"><b>italic</b></a> () const</li> <li class=fn>int <a href="#weight"><b>weight</b></a> () const</li> <li class=fn>bool <a href="#bold"><b>bold</b></a> () const</li> <li class=fn>bool <a href="#fixedPitch"><b>fixedPitch</b></a> () const</li> <li class=fn>QFont::StyleHint <a href="#styleHint"><b>styleHint</b></a> () const</li> <li class=fn>bool <a href="#rawMode"><b>rawMode</b></a> () const</li> <li class=fn>bool <a href="#exactMatch"><b>exactMatch</b></a> () const</li> </ul> <hr><a name="details"></a><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="#family">family</a>(), <a href="#pointSize">pointSize</a>(), <a href="#italic">italic</a>(), <a href="#weight">weight</a>(), <a href="#fixedPitch">fixedPitch</a>(), <a href="#styleHint">styleHint</a>() etc. But whilst the QFont 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> For example, when the program asks for a 25pt Courier font on a machine that has a non-scalable 24pt Courier font, QFont will (normally) use the 24pt Courier for rendering. In this case, <a href="qfont.html#pointSize">QFont::pointSize</a>() returns 25 and <a href="#pointSize">QFontInfo::pointSize</a>() returns 24. <p> There are three ways to create a QFontInfo object. <ol type=1> <li> Calling the QFontInfo constructor with a QFont creates a font info object for a screen-compatible font, i.e. the font cannot be a printer font<sup>*</sup>. If the font is changed later, the font info object is <em>not</em> updated. <p> <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 <em>not</em> updated. <p> <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 <em>not</em> updated. </ol> <p> <sup>*</sup> 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> <p>See also <a href="qfont.html">QFont</a>, <a href="qfontmetrics.html">QFontMetrics</a>, <a href="qfontdatabase.html">QFontDatabase</a>, <a href="graphics.html">Graphics Classes</a>, and <a href="shared.html">Implicitly and Explicitly Shared Classes</a>. <hr><h2>Member Function Documentation</h2> <h3 class=fn><a name="QFontInfo"></a>QFontInfo::QFontInfo ( const <a href="qfont.html">QFont</a> & font ) </h3> Constructs a font info object for <em>font</em>. <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> 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> 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. <h3 class=fn><a name="QFontInfo-2"></a>QFontInfo::QFontInfo ( const <a href="qfont.html">QFont</a> & font, <a href="qfont.html#Script-enum">QFont::Script</a> script ) </h3> Constructs a font info object for <em>font</em> using the specified <em>script</em>. <h3 class=fn><a name="QFontInfo-3"></a>QFontInfo::QFontInfo ( const <a href="qfontinfo.html">QFontInfo</a> & fi ) </h3> Constructs a copy of <em>fi</em>. <h3 class=fn><a name="~QFontInfo"></a>QFontInfo::~QFontInfo () </h3> Destroys the font info object. <h3 class=fn>bool <a name="bold"></a>QFontInfo::bold () const </h3> <p> Returns TRUE if <a href="#weight">weight</a>() would return a value greater than <a href="qfont.html#Weight-enum">QFont::Normal</a>; otherwise returns FALSE. <p> <p>See also <a href="#weight">weight</a>() and <a href="qfont.html#bold">QFont::bold</a>(). <p>Example: <a href="qfd-example.html#x1982">qfd/fontdisplayer.cpp</a>. <h3 class=fn>bool <a name="exactMatch"></a>QFontInfo::exactMatch () const </h3> Returns TRUE if the matched window system font is exactly the same as the one specified by the font; otherwise returns FALSE. <p> <p>See also <a href="qfont.html#exactMatch">QFont::exactMatch</a>(). <h3 class=fn><a href="qstring.html">QString</a> <a name="family"></a>QFontInfo::family () const </h3> Returns the family name of the matched window system font. <p> <p>See also <a href="qfont.html#family">QFont::family</a>(). <p>Examples: <a href="simple-font-demo-example.html#x2848">fonts/simple-qfont-demo/viewer.cpp</a> and <a href="qfd-example.html#x1983">qfd/fontdisplayer.cpp</a>. <h3 class=fn>bool <a name="fixedPitch"></a>QFontInfo::fixedPitch () const </h3> Returns the fixed pitch value of the matched window system font. <p> <p>See also <a href="qfont.html#fixedPitch">QFont::fixedPitch</a>(). <h3 class=fn>bool <a name="italic"></a>QFontInfo::italic () const </h3> Returns the italic value of the matched window system font. <p> <p>See also <a href="qfont.html#italic">QFont::italic</a>(). <p>Example: <a href="qfd-example.html#x1984">qfd/fontdisplayer.cpp</a>. <h3 class=fn><a href="qfontinfo.html">QFontInfo</a> & <a name="operator-eq"></a>QFontInfo::operator= ( const <a href="qfontinfo.html">QFontInfo</a> & fi ) </h3> Assigns the font info in <em>fi</em>. <h3 class=fn>int <a name="pixelSize"></a>QFontInfo::pixelSize () const </h3> Returns the pixel size of the matched window system font. <p> <p>See also <a href="qfont.html#pointSize">QFont::pointSize</a>(). <h3 class=fn>int <a name="pointSize"></a>QFontInfo::pointSize () const </h3> Returns the point size of the matched window system font. <p> <p>See also <a href="qfont.html#pointSize">QFont::pointSize</a>(). <p>Examples: <a href="simple-font-demo-example.html#x2849">fonts/simple-qfont-demo/viewer.cpp</a> and <a href="qfd-example.html#x1985">qfd/fontdisplayer.cpp</a>. <h3 class=fn>bool <a name="rawMode"></a>QFontInfo::rawMode () const </h3> Returns TRUE if the font is a raw mode font; otherwise returns FALSE. <p> If it is a raw mode font, all other functions in QFontInfo will return the same values set in the <a href="qfont.html">QFont</a>, regardless of the font actually used. <p> <p>See also <a href="qfont.html#rawMode">QFont::rawMode</a>(). <h3 class=fn><a href="qfont.html#StyleHint-enum">QFont::StyleHint</a> <a name="styleHint"></a>QFontInfo::styleHint () const </h3> Returns the style of the matched window system font. <p> Currently only returns the style hint set in <a href="qfont.html">QFont</a>. <p> <p>See also <a href="qfont.html#styleHint">QFont::styleHint</a>() and <a href="qfont.html#StyleHint-enum">QFont::StyleHint</a>. <h3 class=fn>int <a name="weight"></a>QFontInfo::weight () const </h3> Returns the weight of the matched window system font. <p> <p>See also <a href="qfont.html#weight">QFont::weight</a>() and <a href="#bold">bold</a>(). <!-- eof --> <hr><p> This file is part of the <a href="index.html">Qt toolkit</a>. Copyright © 1995-2007 <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center> <table width=100% cellspacing=0 border=0><tr> <td>Copyright © 2007 <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a> <td align=right><div align=right>Qt 3.3.8</div> </table></div></address></body> </html>