⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qfont.3qt

📁 Trolltech公司发布的基于C++图形开发环境
💻 3QT
📖 第 1 页 / 共 2 页
字号:
.PPSee also setFamily(), setPointSize(), setWeight() and setItalic()..SH "QFont::QFont ( const QString & family, int pointSize, int weight, bool italic, CharSet charSet )"Constructs a font object with the specified \fIfamily, pointSize, weight, italic\fR and \fIcharSet\fR settings. If \fIpointSize\fR is less than or equal to 0 it is set to 1..PPSee also setFamily(), setPointSize(), setWeight() and setItalic()..SH "QFont::QFont ( const QFont & font )"Constructs a font that is a copy of \fIfont.\fR.SH "QFont::~QFont ()"Destructs the font object..SH "bool QFont::bold () const"Returns TRUE if weight() is a value greater than \fCQFont::Normal,\fR otherwise FALSE..PPSee also weight(), setBold() and QFontInfo::bold()..SH "void QFont::cacheStatistics () \fC[static]\fR"Internal function that dumps font cache statistics..SH "QFont::CharSet QFont::charSet() const"Returns the character set by setCharSet()..PPUse QFontInfo to find the CharSet of the window system font actually used..PPSee also setCharSet()..SH "QFont::CharSet QFont::charSetForLocale() \fC[static]\fR"Returns a guess at the character set most likely to be appropriate for the locale the application is running in. This is the character sets fonts will use by default..SH "void QFont::cleanup () \fC[static]\fR"Internal function that cleans up the font system..SH "int QFont::deciPointSize () const \fC[protected]\fR"Returns the point size in 1/10ths of a point..PPSee also pointSize()..SH "QString QFont::defaultFamily () const \fC[protected]\fR"Returns the family name that corresponds to the current style hint..SH "QFont QFont::defaultFont () \fC[static]\fR"Returns the QApplication default font..PPThis function will be removed in a future version of Qt. Please use QApplication::font() instead..SH "bool QFont::dirty () const \fC[protected]\fR"Returns TRUE if the font attributes have been changed and the font has to be (re)loaded, or FALSE if no changes have been made..SH "QString QFont::encodingName ( CharSet cs ) \fC[static]\fR"Returns the encoding name of a character set, e.g. QFont::ISO_8859_1 returns "iso8859-1" and QFont::Unicode returns "iso10646"..SH "bool QFont::exactMatch () const"Returns TRUE if a window system font exactly matching the settings of this font is available..PPSee also QFontInfo..SH "QString QFont::family () const"Returns the family name set by setFamily()..PPUse QFontInfo to find the family name of the window system font that is actually used for drawing..PPExample:.PP.nf.br    QFont     font( "Nairobi" );.br    QFontInfo info( font );.br    qDebug( "Font family requested is    : \\"%s\\"", font.family() );.br    qDebug( "Font family actually used is: \\"%s\\"", info.family() );.fi.PPSee also setFamily() and substitute()..SH "bool QFont::fixedPitch () const"Returns the value set by setFixedPitch()..PPUse QFontInfo to find the fixed pitch value of the window system font actually used..PPSee also setFixedPitch() and QFontInfo::fixedPitch()..SH "void QFont::initialize () \fC[static]\fR"Internal function that initializes the font system..SH "void QFont::insertSubstitution ( const QString & familyName, const QString & replacementName ) \fC[static]\fR"Inserts a new font family name substitution in the family substitution table..PPIf \fIfamilyName\fR already exists in the substitution table, it will be replaced with this new substitution..PPSee also removeSubstitution(), substitutions() and substitute()..SH "bool QFont::isCopyOf ( const QFont & f ) const"Returns TRUE if this font and \fIf\fR are copies of each other, i.e. one of them was created as a copy of the other and neither was subsequently modified. This is much stricter than equality..PPSee also operator= and operator==..SH "bool QFont::italic () const"Returns the value set by setItalic()..PPUse QFontInfo to find the italic value of the window system font actually used..PPSee also setItalic()..SH "QString QFont::key () const"Returns the font's key, which is a textual representation of the font settings. It is typically used to insert and find fonts in a dictionary or a cache..PPSee also QMap..SH "QString QFont::lastResortFamily () const \fC[protected]\fR"Returns a last resort family name for the font matching algorithm..PPSee also lastResortFont()..SH "QString QFont::lastResortFont () const \fC[protected]\fR"Returns a last resort raw font name for the font matching algorithm. This is used if even the last resort family is not available. It returns \fIsomething,\fR almost no matter what..PPThe current implementation tries a wide variety of common fonts, returning the first one it finds. The implementation may change at any time..PPSee also lastResortFamily()..SH "void QFont::locale_init () \fC[static]\fR"Internal function that uses locale information to find the preferred character set of loaded fonts..SH "bool QFont::operator!= ( const QFont & f ) const"Returns TRUE if the this font is different from \fIf,\fR or FALSE if they are equal..PPTwo QFonts are different if their font attributes are different. If rawMode() is enabled for both fonts, then only the family fields are compared..PPSee also operator==()..SH "QFont & QFont::operator= ( const QFont & font )"Assigns \fIfont\fR to this font and returns a reference to this font..SH "bool QFont::operator== ( const QFont & f ) const"Returns TRUE if the this font is equal to \fIf,\fR or FALSE if they are different..PPTwo QFonts are equal if their font attributes are equal. If rawMode() is enabled for both fonts, then only the family fields are compared..PPSee also operator!=()..SH "int QFont::pixelSize () const"Returns the logical pixel height of characters in the font if shown on the screen..SH "int QFont::pointSize () const"Returns the point size set by setPointSize()..PPUse QFontInfo to find the point size of the window system font actually used..PPExample of use:.PP.nf.br    QFont     font( "helvetica" );.br    QFontInfo info( font );.br    font.setPointSize( 53 );.br    qDebug( "Font size requested is    : %d", font.pointSize() );.br    qDebug( "Font size actually used is: %d", info.pointSize() );.fi.PPSee also setPointSize() and deciPointSize()..SH "float QFont::pointSizeFloat () const"Returns the height of characters in the font in points (1/72 inch)..PPSee also pointSize()..SH "bool QFont::rawMode () const"Returns the value set by setRawMode()..PPSee also setRawMode()..SH "QString QFont::rawName () const"Returns the name of the font within the underlying window system. On Windows, this is usually just the family name of a true type font. Under X, it is a rather complex XLFD (X Logical Font Description). Using the return value of this function is usually \fInot portable.\fR.PPSee also setRawName()..SH "void QFont::removeSubstitution ( const QString & familyName ) \fC[static]\fR"Removes a font family name substitution from the family substitution table..PPSee also insertSubstitution(), substitutions() and substitute()..SH "void QFont::setBold ( bool enable )"Sets the weight to \fCQFont::Bold\fR if \fIenable\fR is TRUE, or to \fCQFont::Normal\fR if \fIenable\fR is FALSE..PPUse setWeight() to set the weight to other values..PPSee also bold() and setWeight()..PPExamples:.(lmenu/menu.cpp.)l.SH "void QFont::setCharSet ( CharSet charset )"Sets the character set encoding (e.g. \fCLatin1).\fR.PPIf the character set encoding is not available another will be used for drawing. For most non-trivial applications you will probably not want this to happen since it can totally obscure the text shown to the user. This is why the font matching algorithm gives high priority to finding the correct character set..PPYou can test that the character set is correct using the QFontInfo class..PPSee also charSet() and QFontInfo..SH "void QFont::setDefaultFont ( const QFont & f ) \fC[static]\fR"\fBThis function is obsolete.\fR It is provided to keep old source working, and will probably be removed in a future version of Qt. We strongly advise against using it in new code..PPPlease use QApplication::setFont() instead..SH "void QFont::setFamily ( const QString & family )"Sets the family name of the font (e.g. "Helvetica" or "times")..PPThe family name is case insensitive..PPIf the family is not available a default family is used..PPSee also family(), setStyleHint() and QFontInfo..SH "void QFont::setFixedPitch ( bool enable )"Sets fixed pitch on or off..PPA fixed pitch font is a font where all characters have the same width..PPSee also fixedPitch() and QFontInfo..SH "void QFont::setItalic ( bool enable )"Sets italic on or off..PPSee also italic() and QFontInfo..SH "void QFont::setPixelSize ( int pixelSize )"Sets the logical height of characters in the font if shown on the screen..SH "void QFont::setPixelSizeFloat ( float pixelSize )"Sets the logical pixel height of characters in the font if shown on the screen..SH "void QFont::setPointSize ( int pointSize )"Sets the point size to \fIpointSize.\fR The point size must be greater than zero..PPExample:.PP.nf.br    QFont font( "courier" );.br    font.setPointSize( 18 );.fi.PPSee also pointSize() and QFontInfo..SH "void QFont::setPointSizeFloat ( float pointSize )"Sets the point size to \fIpointSize.\fR The point size must be greater than zero. The requested precision may not be achieved on all platforms..SH "void QFont::setRawMode ( bool enable )"Turns raw mode on if \fIenable\fR is TRUE, or turns it off if \fIenable\fR is FALSE..PPCalling this function only has effect under X windows. If raw mode is enabled, Qt will search for an X font with a complete font name matching the family name, ignoring all other values set for the QFont. If the font name matches several fonts, Qt will use the first font returned by X. QFontInfo \fIcannot\fR be used to fetch information about a QFont using raw mode (it will return the values set in the QFont for all parameters, including the family name)..PP\fBWarning:\fR Do not use raw mode unless you really, really need it! In most (if not all) cases, setRawName() is a much better choise..PPSee also rawMode() and setRawName()..SH "void QFont::setRawName ( const QString & name )"Sets a font by its system specific name. The function is in particular useful under X, where system font settings ( for example X resources) are usually available as XLFD (X Logical Font Description) only. You can pass an XLFD as \fIname\fR to this function..PPIn Qt 2.0 and later, a font set with setRawName() is still a full-featured QFont. It can be queried (for example with italic()) or modified (for example with setItalic() ) and is therefore also suitable as a basis font for rendering rich text..PPIf Qt's internal font database cannot resolve the raw name, the font becomes a raw font with \fIname\fR as family..PPNote that the present implementation does not handle handle wildcards in XLFDs well, and that font aliases (file \fCfonts.alias\fR in the font directory on X11) are not supported..PPSee also rawName(), setRawMode() and setFamily()..SH "void QFont::setStrikeOut ( bool enable )"Sets strike out on or off..PPSee also strikeOut() and QFontInfo..SH "void QFont::setStyleHint ( StyleHint hint )"Sets the style hint..PPSee also setStyleHint()..PPExamples:.(ldesktop/desktop.cpp.)l.SH "void QFont::setStyleHint ( StyleHint hint, StyleStrategy strategy )"Sets the style hint and strategy..PPThe style hint has a default value of \fCAnyStyle\fR which leaves the task of finding a good default family to the font matching algorithm..PPThe style strategy has a default value of \fCPreferDefault\fR which tells the algorithm not to prefer any type of font..PPIn the example below the push button will display its text label with the Bavaria font family if this family is available, if not it will display its text label with another serif font:.PP.nf.br    #include <qapplication.h>.br    #include <qpushbutton.h>.br    #include <qfont.h>.br.br    int main( int argc, char **argv ).br    {.br        QApplication app( argc, argv );.br        QPushButton  push("Push me");.br.br        QFont font( "Bavaria", 18 );        // preferred family is Bavaria.br        font.setStyleHint( QFont::Serif )    // can also use any serif font.br.br        push.setFont( font );.br        return app.exec( &push );.br    }.fi.PPSee also QFont::StyleHint, styleHint(), QFont::StyleStrategy, styleStrategy() and QFontInfo..SH "void QFont::setUnderline ( bool enable )"Sets underline on or off..PPSee also underline() and QFontInfo..PPExamples:.(lmenu/menu.cpp.)l.SH "void QFont::setWeight ( int weight )"Sets the weight (or boldness), which should be a value from the QFont::Weight enumeration..PPExample:.PP.nf.br    QFont font( "courier" );.br    font.setWeight( QFont::Bold );.fi.PPStrictly speaking you can use all values in the range [0,99] (where 0 is ultralight and 99 is extremely black), but there is perhaps asking too much of the underlying window system..PPIf the specified weight is not available the closest available will be used. Use QFontInfo to check the actual weight..PPSee also weight() and QFontInfo..SH "bool QFont::strikeOut () const"Returns the value set by setStrikeOut()..PPUse QFontInfo to find the strike out value of the window system font actually used..PPSee also setStrikeOut() and QFontInfo::strikeOut()..SH "QFont::StyleHint QFont::styleHint() const"Returns the StyleHint set by setStyleHint()..PPSee also setStyleHint() and QFontInfo::styleHint()..SH "QFont::StyleStrategy QFont::styleStrategy() const"Returns the StyleStratgie set by setStyleHint().PPSee also setStyleHint()..SH "QString QFont::substitute ( const QString & familyName ) \fC[static]\fR"Returns the font family name to be used whenever \fIfamilyName\fR is specified. The lookup is case insensitive..PPIf there is no substitution for \fIfamilyName,\fR then \fIfamilyName\fR is returned..PPExample:.PP.nf.br    QFont::insertSubstitution( "NewYork", "London" );.br    QFont::insertSubstitution( "Paris",   "Texas" );.br.br    QFont::substitute( "NewYork" );     // returns "London".br    QFont::substitute( "PARIS" );       // returns "Texas".br    QFont::substitute( "Rome" );        // returns "Rome".br.br    QFont::removeSubstitution( "newyork" );.br    QFont::substitute( "NewYork" );     // returns "NewYork".fi.PPSee also setFamily(), insertSubstitution() and removeSubstitution()..SH "QStringList QFont::substitutions () \fC[static]\fR"Returns a sorted list of substituted family names..PPSee also insertSubstitution(), removeSubstitution() and substitute()..SH "bool QFont::underline () const"Returns the value set by setUnderline()..PPUse QFontInfo to find the underline value of the window system font actually used for drawing..PPSee also setUnderline() and QFontInfo::underline()..SH "int QFont::weight () const"Returns the weight set by setWeight()..PPUse QFontInfo to find the weight of the window system font actually used..PPSee also setWeight() and QFontInfo..SH RELATED FUNCTION DOCUMENTATION.SH "QDataStream & operator<< (QDataStream & s, const QFont & f)"Writes a font to the stream..PPSee also Format of the QDataStream operators.SH "QDataStream & operator>> (QDataStream & s, QFont & f)"Reads a font from the stream..PPSee also  Format of the QDataStream operators.SH "SEE ALSO".BR http://doc.trolltech.com/qfont.html.BR http://www.trolltech.com/faq/tech.html.SH COPYRIGHTCopyright 1992-2001 Trolltech AS, http://www.trolltech.com.  See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code..SH BUGSIf you find a bug in Qt, please report it as described in.BR http://doc.trolltech.com/bughowto.html .Good bug reports make our job much simpler. Thank you..PIn case of content or formattting problems with this manual page, pleasereport them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qfont.3qt) and the Qtversion (2.3.10).

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -