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.

function CalculateTextSize(AText: string; ARect: TRectF; AWordWrapping: Boolean = False; ASupportHTML: Boolean = True): TSizeF; 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 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.

function CalculateTextSize(AText: string): TSizeF; overload; virtual;

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.

function CalculateTextSize(AText: string; ARect: TRect; AWordWrapping: Boolean = False; ASupportHTML: Boolean = True): TSize; overload; virtual;

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.