📄 qfontmetrics.3qt
字号:
\fCSingleLine\fR ignores newline characters in the text..TP\fCExpandTabs\fR expands tabulators..TP\fCShowPrefix\fR interprets "&x" as "x" underlined..TP\fCWordBreak\fR breaks the text to fit the rectangle..PPHorizontal alignment defaults to AlignLeft and vertical alignment defaults to AlignTop..PPIf several of the horizontal or several of the vertical alignment flags are set, the resulting alignment is undefined..PPThese flags are defined in qnamespace.h..PPIf \fCExpandTabs\fR is set in \fIflgs,\fR then: if \fItabarray\fR is non.zero, it specifies a 0-terminated sequence of pixel-positions for tabs; otherwise if \fItabstops\fR is non-zero, it is used as the tab spacing (in pixels)..PPNote that the bounding rectangle may extend to the left of (0,0), e.g. for italicized fonts, and that the text output may cover \fIall\fR pixels in the bounding rectangle..PPNewline characters are processed as linebreaks..PPDespite the different actual character heights, the heights of the bounding rectangles of "Yes" and "yes" are the same..PPThe bounding rectangle given by this function is somewhat larger than that calculated by the simpler boundingRect() function. This function uses the maximum left and right font bearings as is necessary for multi-line text to align correctly. Also, fontHeight() and lineSpacing() are used to calculate the height, rather than individual character heights..PPThe \fIinternal\fR argument is for internal purposes..PPSee also width(), QPainter::boundingRect() and Qt::AlignmentFlags..PPExamples:.(lxform/xform.cpp.)l.SH "int QFontMetrics::descent () const"Returns the maximum descent of the font..PPThe descent is the distance from the base line to the lowermost line where pixels may be drawn. (Note that this is different from X, which adds 1 pixel.).PPSee also ascent()..PPExamples:.(ldrawdemo/drawdemo.cpp.)l.SH "int QFontMetrics::height () const"Returns the height of the font..PPThis is always equal to ascent()+descent()+1 (the 1 is for the base line)..PPSee also leading() and lineSpacing()..PPExamples:.(lgrapher/grapher.cpp.)l.SH "bool QFontMetrics::inFont ( QChar ch ) const"Returns TRUE if \fIch\fR is a valid character in the font..SH "int QFontMetrics::leading () const"Returns the leading of the font..PPThis is the natural inter-line spacing..PPSee also height() and lineSpacing()..SH "int QFontMetrics::leftBearing ( QChar ch ) const"Returns the left bearing of character \fIch\fR in the font..PPThe left bearing is the rightward distance of the left-most pixel of the character from the logical origin of the character. This value is negative if the pixels of the character extend to the left of the logical origin..PPSee width(QChar) for a graphical description of this metric..PPSee also rightBearing(QChar), minLeftBearing() and width()..SH "int QFontMetrics::lineSpacing () const"Returns the distance from one base line to the next..PPThis value is always equal to leading()+height()..PPSee also height() and leading()..PPExamples:.(lscrollview/scrollview.cpp.)l.SH "int QFontMetrics::lineWidth () const"Returns the width of the underline and strike-out lines, adjusted for the point size of the font..PPSee also underlinePos() and strikeOutPos()..SH "int QFontMetrics::maxWidth () const"Returns the width of the widest character in the font..SH "int QFontMetrics::minLeftBearing () const"Returns the minimum left bearing of the font..PPThis is the smallest leftBearing(char) of all characters in the font..PPNote that this function can be very slow if the font is big..PPSee also minRightBearing() and leftBearing(char)..SH "int QFontMetrics::minRightBearing () const"Returns the minimum right bearing of the font..PPThis is the smallest rightBearing(char) of all characters in the font..PPNote that this function can be very slow if the font is big..PPSee also minLeftBearing() and rightBearing(char)..SH "QFontMetrics & QFontMetrics::operator= ( const QFontMetrics & fm )"Font metrics assignment..SH "int QFontMetrics::rightBearing ( QChar ch ) const"Returns the right bearing of character \fIch\fR in the font..PPThe right bearing is the leftward distance of the right-most pixel of the character from the logical origin of a subsequent character. This value is negative if the pixels of the character extend to the right of the width() of the character..PPSee width() for a graphical description of this metric..PPSee also leftBearing(char), minRightBearing() and width()..SH "QSize QFontMetrics::size ( int flgs, const QString & str, int len=-1, int tabstops=0, int * tabarray=0, char ** intern=0 ) const"Returns the size in pixels of the first \fIlen\fR characters of \fIstr.\fR.PPIf \fIlen\fR is negative (default value), the whole string is used..PPThe \fIflgs\fR argument is the bitwise OR of the following flags: .TP\fCSingleLine\fR ignores newline characters in the text..TP\fCExpandTabs\fR expands tabulators..TP\fCShowPrefix\fR interprets "&x" as "x" underlined..TP\fCWordBreak\fR breaks the text to fit the rectangle..PPThese flags are defined in qnamespace.h..PPIf \fCExpandTabs\fR is set in \fIflgs,\fR then: if \fItabarray\fR is non.zero, it specifies a 0-terminated sequence of pixel-positions for tabs; otherwise if \fItabstops\fR is non-zero, it is used as the tab spacing (in pixels)..PPNewline characters are processed as linebreaks..PPDespite the different actual character heights, the heights of the bounding rectangles of "Yes" and "yes" are the same..PPThe \fIintern\fR argument is for internal purposes..PPSee also boundingRect()..SH "int QFontMetrics::strikeOutPos () const"Returns the distance from the base line to where the strike-out line should be drawn..PPSee also underlinePos() and lineWidth()..SH "int QFontMetrics::underlinePos () const"Returns the distance from the base line to where an underscore should be drawn..PPSee also strikeOutPos() and lineWidth()..SH "int QFontMetrics::width ( QChar ch ) const".ce 1.B "[Image Omitted]".PPReturns the logical width of a \fIch\fR in pixels. This is a distance appropriate for drawing a subsequent character after \fIch.\fR.PPSome of the metrics are described in the image to the right. The tall dark rectangle covers the logical width() of a character. The shorter pale rectangles cover leftBearing() and rightBearing() of the characters. Notice that the bearings of "f" in this particular font are both negative, while the bearings of "o" are both positive..PPSee also boundingRect()..SH "int QFontMetrics::width ( const QString & str, int len = -1 ) const"Returns the width in pixels of the first \fIlen\fR characters of \fIstr.\fR.PPIf \fIlen\fR is negative (the default value is), the whole string is used..PPNote that this value is \fInot\fR equal to boundingRect().width(); boundingRect() returns a rectangle describing the pixels this string will cover whereas width() returns the distance to where the next string should be drawn..PPSee also boundingRect()..PPExamples:.(lmovies/main.cpp scrollview/scrollview.cpp drawdemo/drawdemo.cpp.)l.SH "int QFontMetrics::width ( char c ) const"\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..PPThis is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts..PPProvided to aid porting from Qt 1.x..SH "SEE ALSO".BR http://doc.trolltech.com/qfontmetrics.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 (qfontmetrics.3qt) and the Qtversion (2.3.10).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -