Table of Contents

TTMSFNCGraphics.CalculateText Method

Returns the tightest bounding rectangle that encloses AText when rendered inside ARect with the current font settings.

API unit family: TMSFNCGraphics Declaring type: TTMSFNCGraphics

Overloads

Overload 1

Returns the tightest bounding rectangle that encloses AText when rendered inside ARect with the current font settings.

function CalculateText(AText: String; ARect: TRectF; AWordWrapping: Boolean = False; ASupportHTML: Boolean = True): TRectF; 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 tightest TRectF enclosing the rendered text.

Overload 2

Returns the tightest bounding rectangle that encloses a single-line AText string using the current font.

function CalculateText(AText: String): TRectF; overload; virtual;

Parameters

Name Description
AText Text string to measure.

Returns

The tightest TRectF enclosing the rendered text.

Overload 3

Returns the tightest bounding rectangle that encloses AText when rendered inside ARect with the current font settings.

function CalculateText(AText: String; ARect: TRect; AWordWrapping: Boolean = False; ASupportHTML: Boolean = True): TRect; 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 tightest TRect enclosing the rendered text, in whole pixels.