Qt 4.8
|
The QFontInfo class provides general information about fonts. More...
#include <qfontinfo.h>
Public Functions | |
bool | bold () const |
Returns true if weight() would return a value greater than QFont::Normal; otherwise returns false. More... | |
bool | exactMatch () const |
Returns true if the matched window system font is exactly the same as the one specified by the font; otherwise returns false. More... | |
QString | family () const |
Returns the family name of the matched window system font. More... | |
bool | fixedPitch () const |
Returns the fixed pitch value of the matched window system font. More... | |
bool | italic () const |
Returns the italic value of the matched window system font. More... | |
QFontInfo & | operator= (const QFontInfo &) |
Assigns the font info in fi. More... | |
bool | overline () const |
Returns the overline value of the matched window system font. More... | |
int | pixelSize () const |
Returns the pixel size of the matched window system font. More... | |
int | pointSize () const |
Returns the point size of the matched window system font. More... | |
qreal | pointSizeF () const |
Returns the point size of the matched window system font. More... | |
QFontInfo (const QFont &) | |
Constructs a font info object for font. More... | |
QFontInfo (const QFontInfo &) | |
Constructs a copy of fi. More... | |
bool | rawMode () const |
Returns true if the font is a raw mode font; otherwise returns false. More... | |
bool | strikeOut () const |
Returns the strikeout value of the matched window system font. More... | |
QFont::Style | style () const |
Returns the style value of the matched window system font. More... | |
QFont::StyleHint | styleHint () const |
Returns the style of the matched window system font. More... | |
QString | styleName () const |
Returns the style name of the matched window system font on system that supports it. More... | |
bool | underline () const |
Returns the underline value of the matched window system font. More... | |
int | weight () const |
Returns the weight of the matched window system font. More... | |
~QFontInfo () | |
Destroys the font info object. More... | |
Properties | |
QExplicitlySharedDataPointer< QFontPrivate > | d |
The QFontInfo class provides general information about fonts.
The QFontInfo class provides the same access functions as QFont, e.g. family(), pointSize(), italic(), weight(), fixedPitch(), styleHint() 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.
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, QFont::pointSize() returns 25 and QFontInfo::pointSize() returns 24.
There are three ways to create a QFontInfo object.
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. If the font is changed later, the font info object is not updated.
(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.)
QWidget::fontInfo() 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 not updated.
Definition at line 54 of file qfontinfo.h.
QFontInfo::QFontInfo | ( | const QFont & | font | ) |
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, not QPicture or QPrinter.
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.
Use QPainter::fontInfo() to get the font info when painting. This will give correct results also when painting on paint device that is not screen-compatible.
Definition at line 2634 of file qfont.cpp.
QFontInfo::QFontInfo | ( | const QFontInfo & | fi | ) |
QFontInfo::~QFontInfo | ( | ) |
|
inline |
Returns true if weight() would return a value greater than QFont::Normal; otherwise returns false.
Definition at line 71 of file qfontinfo.h.
bool QFontInfo::exactMatch | ( | ) | const |
Returns true if the matched window system font is exactly the same as the one specified by the font; otherwise returns false.
Definition at line 2878 of file qfont.cpp.
QString QFontInfo::family | ( | ) | const |
Returns the family name of the matched window system font.
Definition at line 2668 of file qfont.cpp.
Referenced by QFontComboBoxPrivate::_q_updateModel(), and qt_set_x11_resources().
bool QFontInfo::fixedPitch | ( | ) | const |
Returns the fixed pitch value of the matched window system font.
Definition at line 2826 of file qfont.cpp.
bool QFontInfo::italic | ( | ) | const |
Returns the italic value of the matched window system font.
Definition at line 2734 of file qfont.cpp.
Referenced by qt_set_x11_resources().
bool QFontInfo::overline | ( | ) | const |
Returns the overline value of the matched window system font.
Here we read the overline flag directly from the QFont. This is OK for X11 and for Windows because we always get what we want.
Definition at line 2803 of file qfont.cpp.
int QFontInfo::pixelSize | ( | ) | const |
Returns the pixel size of the matched window system font.
Definition at line 2722 of file qfont.cpp.
Referenced by QVGFontEngineCleaner::fontEngineDestroyed(), and qt_set_x11_resources().
int QFontInfo::pointSize | ( | ) | const |
Returns the point size of the matched window system font.
Definition at line 2698 of file qfont.cpp.
Referenced by QFontDialog::setCurrentFont().
qreal QFontInfo::pointSizeF | ( | ) | const |
Returns the point size of the matched window system font.
Definition at line 2710 of file qfont.cpp.
Referenced by QCleanlooksStyle::drawControl(), and QMacStyle::drawControl().
bool QFontInfo::rawMode | ( | ) | const |
Returns true if the font is a raw mode font; otherwise returns false.
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.
Definition at line 2867 of file qfont.cpp.
Referenced by qt_set_x11_resources().
bool QFontInfo::strikeOut | ( | ) | const |
Returns the strikeout value of the matched window system font.
Definition at line 2816 of file qfont.cpp.
Referenced by qt_set_x11_resources().
QFont::Style QFontInfo::style | ( | ) | const |
Returns the style value of the matched window system font.
Definition at line 2746 of file qfont.cpp.
Referenced by QFontDatabase::styleString().
QFont::StyleHint QFontInfo::styleHint | ( | ) | const |
Returns the style of the matched window system font.
Currently only returns the style hint set in QFont.
Definition at line 2850 of file qfont.cpp.
Referenced by qt_set_x11_resources().
QString QFontInfo::styleName | ( | ) | const |
Returns the style name of the matched window system font on system that supports it.
Definition at line 2686 of file qfont.cpp.
Referenced by QFontDatabase::styleString().
bool QFontInfo::underline | ( | ) | const |
Returns the underline value of the matched window system font.
Here we read the underline flag directly from the QFont. This is OK for X11 and for Windows because we always get what we want.
Definition at line 2788 of file qfont.cpp.
Referenced by qt_set_x11_resources().
int QFontInfo::weight | ( | ) | const |
Returns the weight of the matched window system font.
Definition at line 2758 of file qfont.cpp.
Referenced by qt_set_x11_resources(), and QFontDatabase::styleString().
|
private |
Definition at line 82 of file qfontinfo.h.
Referenced by exactMatch(), family(), fixedPitch(), italic(), operator=(), overline(), pixelSize(), pointSize(), pointSizeF(), rawMode(), strikeOut(), style(), styleHint(), styleName(), underline(), and weight().