TTMSFNCGraphics.CalculateTextWidth Method
Returns the rendered width of
ATextin pixels when constrained toARect.
API unit family: TMSFNCGraphics
Declaring type: TTMSFNCGraphics
Overloads
Overload 1
Returns the rendered width of
ATextin pixels when constrained toARect.
function CalculateTextWidth(AText: string; ARect: TRectF; AWordWrapping: Boolean = False; ASupportHTML: Boolean = True): Single; overload; virtual;
Parameters
| Name | Description |
|---|---|
AText |
Text string to measure. |
ARect |
Constraint rectangle that limits the available rendering area. |
AWordWrapping |
When True, wraps text at word boundaries within ARect. Default is False. |
ASupportHTML |
When True, interprets HTML tags in the text. Default is True. |
Returns
The rendered width of the text in floating-point pixels.
Overload 2
Returns the single-line rendered width of
ATextin floating-point pixels using the current font.
function CalculateTextWidth(AText: string): Single; overload; virtual;
Parameters
| Name | Description |
|---|---|
AText |
Text string to measure. |
Returns
The rendered width in floating-point pixels.
Overload 3
Returns the rendered width of
ATextin whole pixels when constrained toARect(TRect).
function CalculateTextWidth(AText: string; ARect: TRect; AWordWrapping: Boolean = False; ASupportHTML: Boolean = True): Integer; overload; virtual;
Parameters
| Name | Description |
|---|---|
AText |
Text string to measure. |
ARect |
Constraint rectangle in integer pixels. |
AWordWrapping |
When True, wraps text at word boundaries within ARect. Default is False. |
ASupportHTML |
When True, interprets HTML tags in the text. Default is True. |
Returns
The rendered width of the text in whole pixels.