The following functions are used to calculate the pixel height and width of the font when you use QT for text scrolling:
1. qlabel: fontmetrics (). Width (qstring S): obtains the total pixel width of string S.
Int qfontmetrics: width (const qstring
&
Text, Int
Len=-1) const
Returns the width in pixels of the first
LenCharactersText. If
LenIs negative (the default), the entire string is used.
Note that this value is
NotEqual to boundingrect (). Width ();
Boundingrect () returns a rectangle describing the pixels this string will cover whereas width () returns the distance to where
Next string shoshould be drawn.
See also boundingrect ().
2. qlabel: fontmetrics (). Height (): Get the font height.
Int qfontmetrics: height () const
Returns the height of the font.
This is always equal
Ascent () + descent () + 1
(The 1 is for the base line ).
See also leading () and
Linespacing ().
3. qlabel: fontmetrics (). linespacing (): Get the font height, including the actual width and line spacing of the text.
4. qlabel: fontmetrics (). Leading (): row spacing
Int qfontmetrics: Leading () const
Returns the leading of the font.
This is the natural inter-line spacing.
See also height () and
Linespacing ().
For other functions, see qfontmetrics class reference of QT.
Int qfontmetrics: linespacing () const
Returns the distance from one base line to the next.
This value is always equal
Leading () + height ().
See also height () and
Leading ().