The QFontInfo class provides general information about fonts. More...
#include <qfontinfo.h>
The QFont class might not always map exactly to the specified font for a paint device. The QFontInfo class provides information of the actual font that matched a QFont specification.
There are three ways you can create a QFontInfo object:
Example:
QFont font("reykjavik",24); QFontInfo fi(font); if ( strcmp(font.family(),fi.family()) == 0 ) { ; // got this font } else { ; // got fi.family() instead }
In Qt 2.0 the font info object will no longer be automatically updated when the widget or painter gets a new font. Make sure you program does not depend on this feature.
About efficiency: We recommend that you use the QFontInfo constructor if you can. This is more efficient than getting the font info from a widget or a painter. The QWidget::fontInfo() and QPainter::fontInfo() will become faster in Qt 2.0, when we have removed the automatic update policy.
See also: QFont and QFontMetrics.
Examples: xform/xform.cpp
Constructs a font info object for font.
The font must be screen-compatible, i.e. a font you use when drawing text in widgets or pixmaps. If font is a printer font, you'll probably get wrong results.
Use the QPainter::fontInfo() to get the font info when painting. This is a little slower than using this constructor, but it always gives correct results.
Constructs a copy of fi.
Destroys the font info object.
Returns TRUE if weight() would return a greater than
QFont::Normal,
and FALSE otherwise.
See also: weight() and QFont::bold().
Returns the character set of the matched window system font.
See also: QFont::charSet().
Returns TRUE if the matched window system font is exactly the one specified by the font.
See also: QFont::exactMatch().
Returns the family name of the matched window system font.
See also: QFont::family().
Examples: xform/xform.cpp
Returns the fixed pitch value of the matched window system font. A fixed pitch font is a font that has constant character pixel width.
See also: QFont::fixedPitch().
Returns the italic value of the matched window system font.
See also: QFont::italic().
Examples: xform/xform.cpp
Font info assignment.
Returns the point size of the matched window system font.
See also: QFont::pointSize().
Examples: xform/xform.cpp
Returns TRUE if the font is a raw mode font.
If it is a raw mode font, all other functions in QFontInfo will return the same values set in the QFont, regardless of the font actually used.
Warning: The default font is a raw-mode font.
See also: QFont::rawMode().
Returns the strike out value of the matched window system font.
See also: QFont::strikeOut().
Returns the style of the matched window system font.
Currently only returns the hint set in QFont.
See also: QFont::styleHint().
Returns the underline value of the matched window system font.
See also: QFont::underline().
Returns the weight of the matched window system font.
See also: QFont::weight() and bold().
Examples: xform/xform.cpp
Search the documentation, FAQ, qt-interest archive and more (uses
www.troll.no):
This file is part of the Qt toolkit, copyright © 1995-98 Troll Tech, all rights reserved.
It was generated from the following files:
Copyright İ 1998 Troll Tech | Trademarks | Qt version 1.42
|