FontMetrics QML Type
Provides metrics for a given font 更多...
Import Statement: | import QtQuick 2.7 |
开始支持版本: | Qt 5.4 |
属性
- ascent : real
- averageCharacterWidth : real
- descent : real
- font : font
- height : real
- leading : real
- lineSpacing : real
- lineWidth : real
- maximumCharacterWidth : real
- minimumLeftBearing : real
- minimumRightBearing : real
- overlinePosition : real
- strikeOutPosition : real
- underlinePosition : real
- xHeight : real
方法
- qreal advanceWidth(string text)
- rect boundingRect(string text)
- string elidedText(string text, enumeration mode, real width, int flags)
- rect tightBoundingRect(string text)
详细描述
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 }
参见 QFontMetricsF and TextMetrics.
属性
This property holds the ascent of the font.
参见 QFontMetricsF::ascent(), descent, and height.
This property holds the average width of glyphs in the font.
This property holds the descent of the font.
参见 QFontMetricsF::descent(), ascent, and height.
font : font |
This property holds the font used for the metrics calculations.
This property holds the height of the font.
This property holds the leading of the font.
This property holds the distance from one base line to the next.
This property holds the width of the underline and strikeout lines, adjusted for the point size of the font.
This property holds the width of the widest character in the font.
This property holds the minimum left bearing of the font.
This property holds the minimum right bearing of the font.
This property holds the distance from the base line to where an overline should be drawn.
参见 QFontMetricsF::overlinePos(), underlinePosition, and strikeOutPosition.
This property holds the distance from the base line to where the strikeout line should be drawn.
参见 QFontMetricsF::strikeOutPos(), overlinePosition, and underlinePosition.
This property holds the distance from the base line to where an underscore should be drawn.
参见 QFontMetricsF::underlinePos(), overlinePosition, and strikeOutPosition.
This property holds the 'x' height of the font.
成员
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.
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.
This method returns a 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 flags argument is optional and currently only supports Qt::TextShowMnemonic.
This method is offered as an imperative alternative to the elidedText property of TextMetrics.
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.