QFontMetrics
Hierarchy
↳ QFontMetrics
Index
Constructors
Properties
Methods
- ascent
- averageCharWidth
- boundingRect
- capHeight
- descent
- elidedText
- fontDpi
- height
- horizontalAdvance
- inFont
- inFontUcs4
- leading
- leftBearing
- lineSpacing
- lineWidth
- maxWidth
- minLeftBearing
- minRightBearing
- overlinePos
- rightBearing
- size
- strikeOutPos
- swap
- tightBoundingRect
- underlinePos
- xHeight
Constructors
constructor
+ new QFontMetrics(native
: NativeElement): QFontMetrics
Overrides Component.constructor
Parameters:
Name | Type |
---|---|
native | NativeElement |
Returns: QFontMetrics
+ new QFontMetrics(qfont
: QFont): QFontMetrics
Overrides Component.constructor
Parameters:
Name | Type |
---|---|
qfont | QFont |
Returns: QFontMetrics
+ new QFontMetrics(qfontmetrics
: QFontMetrics): QFontMetrics
Overrides Component.constructor
Parameters:
Name | Type |
---|---|
qfontmetrics | QFontMetrics |
Returns: QFontMetrics
Properties
native
• native: NativeElement | null
Inherited from Component.native
Methods
ascent
â–¸ ascent(): number
Returns the ascent of the font
Returns: number
averageCharWidth
â–¸ averageCharWidth(): number
Returns the average width of glyphs in the font
Returns: number
boundingRect
â–¸ boundingRect(text
: string): QRect
Parameters:
Name | Type |
---|---|
text | string |
Returns: QRect
capHeight
â–¸ capHeight(): number
Returns the cap height of the font
Returns: number
descent
â–¸ descent(): number
Returns the descent of the font
Returns: number
elidedText
â–¸ elidedText(text
: string, mode
: TextElideMode, width
: number, flags
: number): string
Parameters:
Name | Type | Default |
---|---|---|
text | string | - |
mode | TextElideMode | - |
width | number | - |
flags | number | 0 |
Returns: string
fontDpi
â–¸ fontDpi(): number
Returns the font DPI
Returns: number
height
â–¸ height(): number
Returns the height of the font
Returns: number
horizontalAdvance
â–¸ horizontalAdvance(text
: string, len
: number): number
Returns the horizontal advance in pixels of the first len characters of text. If len is negative (the default), the entire string is used
Parameters:
Name | Type | Default |
---|---|---|
text | string | - |
len | number | -1 |
Returns: number
inFont
â–¸ inFont(text
: string): number
Returns true if character ch is a valid character in the font; otherwise returns false
Parameters:
Name | Type |
---|---|
text | string |
Returns: number
inFontUcs4
â–¸ inFontUcs4(ucs4
: number): boolean
Parameters:
Name | Type |
---|---|
ucs4 | number |
Returns: boolean
leading
â–¸ leading(): number
Returns the leading of the font
Returns: number
leftBearing
â–¸ leftBearing(text
: string): number
Returns the left bearing of character ch in the font
Parameters:
Name | Type |
---|---|
text | string |
Returns: number
lineSpacing
â–¸ lineSpacing(): number
Returns the distance from one base line to the next
Returns: number
lineWidth
â–¸ lineWidth(): number
Returns the width of the underline and strikeout lines, adjusted for the point size of the font
Returns: number
maxWidth
â–¸ maxWidth(): number
Returns: number
minLeftBearing
â–¸ minLeftBearing(): number
Returns: number
minRightBearing
â–¸ minRightBearing(): number
Returns: number
overlinePos
â–¸ overlinePos(): number
Returns the distance from the base line to where an overline should be drawn
Returns: number
rightBearing
â–¸ rightBearing(text
: string): number
Returns the right bearing of character ch in the font
Parameters:
Name | Type |
---|---|
text | string |
Returns: number
size
â–¸ size(flags
: TextFlag, text
: string, tabStops
: number): QSize
Returns the size in pixels of text
See QtEnums::TextFlag for flags
Parameters:
Name | Type | Default |
---|---|---|
flags | TextFlag | - |
text | string | - |
tabStops | number | 0 |
Returns: QSize
strikeOutPos
â–¸ strikeOutPos(): number
Returns the distance from the base line to where the strikeout line should be drawn
Returns: number
swap
â–¸ swap(other
: QFontMetrics): void
Swaps metrics other with this metrics. This operation is very fast and never fails
Parameters:
Name | Type |
---|---|
other | QFontMetrics |
Returns: void
tightBoundingRect
â–¸ tightBoundingRect(text
: string): QRect
Parameters:
Name | Type |
---|---|
text | string |
Returns: QRect
underlinePos
â–¸ underlinePos(): number
Returns the distance from the base line to where an underscore should be drawn
Returns: number
xHeight
â–¸ xHeight(): number
Returns the 'x' height of the font. This is often but not always the same as the height of the character 'x'.
Returns: number