FontMetrics QML Type
Provides metrics for a given font More...
Import Statement: | import QtQuick 2.4 |
Since: | Qt 5.4 |
Properties
- 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
Methods
- qreal advanceWidth(string text)
- rect boundingRect(string text)
- string elidedText(string text)
- rect tightBoundingRect(string text)
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 QFontMetricsF and TextMetrics.
Property Documentation
This property holds the ascent of the font.
See also QFontMetricsF::ascent(), descent, and height.
This property holds the average width of glyphs in the font.
See also QFontMetricsF::averageCharWidth().
This property holds the descent of the font.
See also 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.
See also QFontMetricsF::height().
This property holds the leading of the font.
See also QFontMetricsF::leading().
This property holds the distance from one base line to the next.
See also QFontMetricsF::lineSpacing().
This property holds the width of the underline and strikeout lines, adjusted for the point size of the font.
See also QFontMetricsF::lineWidth().
This property holds the width of the widest character in the font.
See also QFontMetricsF::maxWidth().
This property holds the minimum left bearing of the font.
See also QFontMetricsF::minLeftBearing().
This property holds the minimum right bearing of the font.
See also QFontMetricsF::minRightBearing().
This property holds the distance from the base line to where an overline should be drawn.
See also QFontMetricsF::overlinePos(), underlinePosition, and strikeOutPosition.
This property holds the distance from the base line to where the strikeout line should be drawn.
See also QFontMetricsF::strikeOutPos(), overlinePosition, and underlinePosition.
This property holds the distance from the base line to where an underscore should be drawn.
See also QFontMetricsF::underlinePos(), overlinePosition, and strikeOutPosition.
This property holds the 'x' height of the font.
See also QFontMetricsF::xHeight().
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 QFontMetricsF::width() and 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 QFontMetricsF::boundingRect() and tightBoundingRect().
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 QFontMetricsF::tightBoundingRect() and boundingRect().
© 2015 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.