qfont.3qt
来自「tmark1.11:用于生成QT/EMBEDDED应用工程的Markfile文件」· 3QT 代码 · 共 707 行 · 第 1/2 页
3QT
707 行
.TH QFont 3qt "6 July 1999" "Troll Tech AS" \" -*- nroff -*-.\" Copyright 1992-1999 Troll Tech AS. All rights reserved. See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQFont \- Font used for drawing text.SH SYNOPSIS.br.PP\fC#include <qfont.h>\fR.PP.SS "Public Members".in +1c.ti -1c.BI "enum \fBCharSet\fR { ISO_8859_1, Latin1 = ISO_8859_1, AnyCharSet, ISO_8859_2, Latin2 = ISO_8859_2, ISO_8859_3, Latin3 = ISO_8859_3, ISO_8859_4, Latin4 = ISO_8859_4, ISO_8859_5, ISO_8859_6, ISO_8859_7, ISO_8859_8, ISO_8859_9, Latin5 = ISO_8859_9, ISO_8859_10, Latin6 = ISO_8859_10, ISO_8859_11, ISO_8859_12, ISO_8859_13, Latin7 = ISO_8859_13, ISO_8859_14, Latin8 = ISO_8859_14, ISO_8859_15, Latin9 = ISO_8859_15, KOI8R, Set_Ja, Set_1 = Set_Ja, Set_Ko, Set_Th_TH, Set_Zh, Set_Zh_TW, Set_N = Set_Zh_TW, Unicode }".br.ti -1c.BI "enum \fBStyleHint\fR { Helvetica, Times, Courier, OldEnglish, System, AnyStyle, SansSerif = Helvetica, Serif = Times, TypeWriter = Courier, Decorative = OldEnglish}".br.ti -1c.BI "enum \fBWeight\fR { Light = 25, Normal = 50, DemiBold = 63, Bold = 75, Black = 87 }".br.ti -1c.BI "\fBQFont\fR ()".br.ti -1c.BI "\fBQFont\fR ( const QString & " "family" ", int " "pointSize" " = 12, int " "weight" " = Normal, bool " "italic" " = FALSE )".br.ti -1c.BI "\fBQFont\fR ( const QString & " "family" ", int " "pointSize" ", int " "weight" ", bool " "italic" ", CharSet charSet )".br.ti -1c.BI "\fBQFont\fR ( const QFont & )".br.ti -1c.BI "\fB~QFont\fR ()".br.ti -1c.BI "QFont& \fBoperator=\fR ( const QFont & )".br.ti -1c.BI "QString \fBfamily\fR () const".br.ti -1c.BI "void \fBsetFamily\fR ( const QString & )".br.ti -1c.BI "int \fBpointSize\fR () const".br.ti -1c.BI "float \fBpointSizeFloat\fR () const".br.ti -1c.BI "void \fBsetPointSize\fR ( int )".br.ti -1c.BI "void \fBsetPointSizeFloat\fR ( float )".br.ti -1c.BI "int \fBpixelSize\fR () const".br.ti -1c.BI "void \fBsetPixelSize\fR ( int )".br.ti -1c.BI "void \fBsetPixelSizeFloat\fR ( float )".br.ti -1c.BI "int \fBweight\fR () const".br.ti -1c.BI "void \fBsetWeight\fR ( int )".br.ti -1c.BI "bool \fBbold\fR () const".br.ti -1c.BI "void \fBsetBold\fR ( bool )".br.ti -1c.BI "bool \fBitalic\fR () const".br.ti -1c.BI "void \fBsetItalic\fR ( bool )".br.ti -1c.BI "bool \fBunderline\fR () const".br.ti -1c.BI "void \fBsetUnderline\fR ( bool )".br.ti -1c.BI "bool \fBstrikeOut\fR () const".br.ti -1c.BI "void \fBsetStrikeOut\fR ( bool )".br.ti -1c.BI "bool \fBfixedPitch\fR () const".br.ti -1c.BI "void \fBsetFixedPitch\fR ( bool )".br.ti -1c.BI "StyleHint \fBstyleHint\fR () const".br.ti -1c.BI "void \fBsetStyleHint\fR ( StyleHint )".br.ti -1c.BI "CharSet \fBcharSet\fR () const".br.ti -1c.BI "void \fBsetCharSet\fR ( CharSet )".br.ti -1c.BI "bool \fBrawMode\fR () const".br.ti -1c.BI "void \fBsetRawMode\fR ( bool )".br.ti -1c.BI "bool \fBexactMatch\fR () const".br.ti -1c.BI "bool \fBoperator==\fR ( const QFont & ) const".br.ti -1c.BI "bool \fBoperator!=\fR ( const QFont & ) const".br.ti -1c.BI "bool \fBisCopyOf\fR ( const QFont & ) const".br.ti -1c.BI "void \fBsetRawName\fR ( const QString & )".br.ti -1c.BI "QString \fBrawName\fR () const".br.ti -1c.BI "QString \fBkey\fR () const".br.in -1c.SS "Static Public Members".in +1c.ti -1c.BI "CharSet \fBcharSetForLocale\fR ()".br.ti -1c.BI "QString \fBencodingName\fR ( CharSet )".br.ti -1c.BI "const QFont \fBdefaultFont\fR ()".br.ti -1c.BI "void \fBsetDefaultFont\fR ( const QFont & )".br.ti -1c.BI "QString \fBsubstitute\fR ( const QString & familyName )".br.ti -1c.BI "void \fBinsertSubstitution\fR ( const QString &, const QString & )".br.ti -1c.BI "void \fBremoveSubstitution\fR ( const QString & )".br.ti -1c.BI "QStringList \fBsubstitutions\fR ()".br.ti -1c.BI "void \fBinitialize\fR ()".br.ti -1c.BI "void \fBlocale_init\fR ()".br.ti -1c.BI "void \fBcleanup\fR ()".br.ti -1c.BI "void \fBcacheStatistics\fR ()".br.in -1c.SS "Protected Members".in +1c.ti -1c.BI "bool \fBdirty\fR () const".br.ti -1c.BI "QString \fBdefaultFamily\fR () const".br.ti -1c.BI "QString \fBlastResortFamily\fR () const".br.ti -1c.BI "QString \fBlastResortFont\fR () const".br.ti -1c.BI "int \fBdeciPointSize\fR () const".br.in -1c.SH RELATED FUNCTION DOCUMENTATION(Note that these are not member functions.).in +1c.ti -1c.BI "QDataStream & \fBoperator<<\fR (QDataStream & " "s" ", const QFont & " "f" ")".br.ti -1c.BI "QDataStream & \fBoperator>>\fR (QDataStream & " "s" ", QFont & " "f" ")".br.in -1c.SH DESCRIPTIONThe QFont class specifies a font used for drawing text..PPQFont, more precisely, is a collection of attributes of a font. When Qt needs to draw text, it will look up and load the closest matching installed font and draw using that..PPThe most important attributes of a QFont are family, point size, weight and italic. There are QFont constructors that take these attributes as arguments, as shown in this example:.PP.nf.br void MyWidget::paintEvent( QPaintEvent * ).br {.br QPainter p( this );.br.br // times, 12pt, normal.br p.setFont( QFont( "times" ) );.br p.drawText( 10, 20, "Text1" );.br.br // helvetica, 18pt, normal.br p.setFont( QFont( "helvetica", 18 ) );.br p.drawText( 10, 120, "Text2" );.br.br // courier, 24pt, bold.br p.setFont( QFont( "courier", 24, QFont::Bold ) );.br p.drawText( 10, 220, "Text3" );.br.br // lucida, 36pt, bold, italic.br p.setFont( QFont( "lucida", 36, QFont::Bold, TRUE ) );.br p.drawText( 10, 320, "Text4" );.br }.fi.PPThe default QFont constructor makes a copy of the application's default font..PPYou can also change these attributes of an existing QFont object using functions such as setFamily(), setPointSize(), setWeight() and setItalic()..PPThere are also some less-used attributes. setUnderline() decides whether the font is underlined or not; setStrikeOut() can be used to get overstrike (a horizontal line through the middle of the characters); setFixedPitch() determines whether Qt should give preference to fixed-pitch (also known as fixed-width) or variable-pitch fonts when it needs to choose an installed font; setStyleHint() can be used to offer more general help to the font matching algorithm, and on X11 setRawName() can be used to bypass the entire font matching and use an X11 XLFD..PPOf course there is also a reader function for each of these set*() functions. Note that the reader functions return the values previously set, \fInot\fR the attributes of the actual window system font that will be used for drawing. You can get information about the font that will be used for drawing by using QFontInfo, but be aware that QFontInfo may be slow and that its results depend on what fonts are installed..PPIn general font handling and loading are costly operations, especially on X11. The QFont class contains extensive optimizations to make copying of QFont objects fast, and to cache the results of the slow window system functions it uses..PPQFont also offers a few static functions, mostly to tune the font matching algorithm: You can control what happens if a font's family isn't installed using insertSubstitution() and removeSubstitution(), ask what happens for a single family using substitute() and you can get a complete list of the fallback families using listSubstitutions()..PPcacheStatistics() offers cache effectiveness information; this is useful mostly for debugging..PPFinally, QApplication::setFont() allows you to set the default font. The default default font is chosen at application startup from a set of common installed fonts that support the correct character set for the current locale. \\endlink Of course, the initialization algorithm has a default, too: The default default default font!.PPFor more general information on fonts, see the comp.fonts FAQ and for more general information on encodings, see or Roman Czyborra's font encodings..PPSee also: QFontMetrics, QFontInfo, QApplication::setFont(), QWidget::setFont(), QPainter::setFont(), QFont::StyleHint, QFont::CharSet and QFont::Weight..PPExamples:.(lshowimg/main.cpp grapher/grapher.cpp xform/xform.cpp tetrix/tetrix.cpp drawdemo/drawdemo.cpp desktop/desktop.cpp scrollview/scrollview.cpp movies/main.cpp picture/picture.cpp hello/main.cpp.)l.SS "Member Type Documentation".SH "QFont::CharSet"The following character set encodings are available: .TP\fCQFont::ISO_8859_1\fR - Latin1 , common in much of Europe.TP\fCQFont::ISO_8859_2\fR - Latin2, Central and Eastern European character set.TP\fCQFont::ISO_8859_3\fR - Latin3, less common European character set.TP\fCQFont::ISO_8859_4\fR - Latin4, less common European character set.TP\fCQFont::ISO_8859_5,\fR Cyrillic.TP\fCQFont::ISO_8859_6,\fR Arabic.TP\fCQFont::ISO_8859_7,\fR Greek.TP\fCQFont::ISO_8859_8,\fR Hebrew.TP\fCQFont::ISO_8859_9,\fR Turkish.TP\fCQFont::ISO_8859_10..15,\fR other ISO 8859 characters sets.TP\fCQFont::KOI8R\fR - KOI8-R, Cyrillic, defined in <a href="http://ds.internic.net/rfc/rfc1489.txt">RFC 1489..TP\fCQFont::AnyCharSet\fR - whatever is handiest..SH "QFont::StyleHint"Style hints are used by the <a href="fontmatch.html">font matching algorithm when a selected font family cannot be found and is used to find an appropriate default family..PPThe style hint value of \fCAnyStyle\fR leaves the task of finding a good default family to the font matching algorithm..PPThe other available style hints are \fCQFont::SansSerif, QFont::TypeWriter, QFont::OldEnglish, QFont::System\fR.SH "QFont::Weight"Contains the predefined font weights:.TP\fCQFont::Light\fR (25).TP\fCQFont::Normal\fR (50).TP\fCQFont::DemiBold\fR (63).TP\fCQFont::Bold\fR (75).TP\fCQFont::Black\fR (87).SH MEMBER FUNCTION DOCUMENTATION.SH "<a name="5c67d5">QFont::QFont ()"Constructs a font object that refers to the default font..PP/sa QApplication::setFont(), QApplication::font()..SH "QFont::QFont ( const QString & family, int pointSize = 12, int weight = Normal, bool italic = FALSE )"Constructs a font object with the specified \fIfamily, pointSize, weight\fR and \fIitalic\fR settings. The character set is copied from the default font and the rest of the settings ser set reasonably..PPIf \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 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 ()"Destroys 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"
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?