Skip to main content
Table of Contents

TTMSFNCGraphics.CalculateTextSize Method

Measures the bounding size of AText when rendered inside ARect with the current font settings.

API unit family: TMSFNCGraphics Declaring type: TTMSFNCGraphics

Overloads

Overload 1

Measures the bounding size of AText when rendered inside ARect with the current font settings.

FMX.TMSFNCGraphics.hppPascalC++
function CalculateTextSize(AText: string; ARect: TRectF; AWordWrapping: Boolean = False; ASupportHTML: Boolean = True): TSizeF; overload; virtual;
virtual System::Types::TSizeF __fastcall CalculateTextSize(System::UnicodeString AText, const System::Types::TRectF &ARect, bool AWordWrapping = false, bool ASupportHTML = true)/* overload */;

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 width and height of the rendered text as a TSizeF.

Overload 2

Measures the bounding size of a single-line AText string using the current font.

FMX.TMSFNCGraphics.hppPascalC++
function CalculateTextSize(AText: string): TSizeF; overload; virtual;
virtual System::Types::TSizeF __fastcall CalculateTextSize(System::UnicodeString AText)/* overload */;

Parameters

Name Description
AText Text string to measure.

Returns

The width and height of the rendered text as a TSizeF.

Overload 3

Measures the bounding size of AText when rendered inside ARect (TRect) with the current font settings.

FMX.TMSFNCGraphics.hppPascalC++
function CalculateTextSize(AText: string; ARect: TRect; AWordWrapping: Boolean = False; ASupportHTML: Boolean = True): TSize; overload; virtual;
virtual System::Types::TSize __fastcall CalculateTextSize(System::UnicodeString AText, const System::Types::TRect &ARect, bool AWordWrapping = false, bool ASupportHTML = true)/* overload */;

Parameters

Name Description
AText Text string to measure.
ARect Constraint rectangle in integer pixels 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 width and height of the rendered text as a TSize in whole pixels.