FontMetrics QML Type▲
-
Import Statement: import QtQuick
-
Since:: Qt 5.4
-
Group: FontMetrics is part of qtquick-text-utility
Detailed Description▲
FontMetrics calculates the size of characters and strings for a given font.
It provides a subset of the C++ QFontMetricsF API, with the added ability to change the font that is used for calculations via the font property.
FontMetrics {
id
:
fontMetrics
font.family: "Arial"
}
Rectangle {
width
:
fontMetrics.height *
4
height
:
fontMetrics.height *
2
}
See Also▲
See also QFontMetricsF, TextMetrics
Property Documentation▲
[read-only] ascent : real▲
This property holds the ascent of the font.
See Also▲
See also QFontMetricsF::ascent(), descent, height
[read-only] averageCharacterWidth : real▲
This property holds the average width of glyphs in the font.
See Also▲
See also QFontMetricsF::averageCharWidth()
[read-only] descent : real▲
This property holds the descent of the font.
See Also▲
See also QFontMetricsF::descent(), ascent, height
font : font▲
This property holds the font used for the metrics calculations.
[read-only] height : real▲
[read-only] leading : real▲
[read-only] lineSpacing : real▲
This property holds the distance from one base line to the next.
See Also▲
See also QFontMetricsF::lineSpacing()
[read-only] lineWidth : real▲
This property holds the width of the underline and strikeout lines, adjusted for the point size of the font.
See Also▲
See also QFontMetricsF::lineWidth()
[read-only] maximumCharacterWidth : real▲
This property holds the width of the widest character in the font.
See Also▲
See also QFontMetricsF::maxWidth()
[read-only] minimumLeftBearing : real▲
This property holds the minimum left bearing of the font.
See Also▲
See also QFontMetricsF::minLeftBearing()
[read-only] minimumRightBearing : real▲
This property holds the minimum right bearing of the font.
See Also▲
See also QFontMetricsF::minRightBearing()
[read-only] overlinePosition : real▲
This property holds the distance from the base line to where an overline should be drawn.
See Also▲
See also QFontMetricsF::overlinePos(), underlinePosition, strikeOutPosition
[read-only] strikeOutPosition : real▲
This property holds the distance from the base line to where the strikeout line should be drawn.
See Also▲
See also QFontMetricsF::strikeOutPos(), overlinePosition, underlinePosition
[read-only] underlinePosition : real▲
This property holds the distance from the base line to where an underscore should be drawn.
See Also▲
See also QFontMetricsF::underlinePos(), overlinePosition, strikeOutPosition
[read-only] xHeight : real▲
Method Documentation▲
qreal advanceWidth(string text)▲
This method returns the advance in pixels of the characters in text. This is the distance from the position of the string to where the next string should be drawn.
This method is offered as an imperative alternative to the advanceWidth property of TextMetrics.
See Also▲
See also QFontMetricsF::horizontalAdvance(), QFontMetricsF::height()
rect boundingRect(string text)▲
This method returns the bounding rectangle of the characters in the string specified by text.
This method is offered as an imperative alternative to the boundingRect property of TextMetrics.
See Also▲
See also QFontMetricsF::boundingRect(), tightBoundingRect()
string elidedText(string text, enumeration mode, real width, int flags)▲
This method returns an elided version of the string (i.e., a string with "..." in it) if the string text is wider than width. Otherwise, returns the original string.
The mode argument specifies the text elide mode; that is, where the ellipsis should appear when displaying text that doesn't fit.
The flags argument is optional and currently only supports Qt::TextShowMnemonic.
This method is offered as an imperative alternative to the elidedText property of TextMetrics.
See Also▲
See also Qt::TextElideMode, QFontMetricsF::elidedText()
rect tightBoundingRect(string text)▲
This method returns a tight bounding rectangle around the characters in the string specified by text.
This method is offered as an imperative alternative to the tightBoundingRect property of TextMetrics.
See Also▲
See also QFontMetricsF::tightBoundingRect(), boundingRect()