New to Telerik UI for WPFStart a free 30-day trial

Measures the layout of text using specified formatting and properties.

Definition

Namespace:Telerik.Windows.Documents.Layout

Assembly:Telerik.Windows.Controls.RichTextBox.dll

Syntax:

C#
public static class RadTextMeasurer

Inheritance: objectRadTextMeasurer

Methods

Measures the width of a given text string based on specified font properties and returns the measurement in pixels.

C#
public static BoxMeasurementInfo Measure(string text, double fontSize, FontFamily fontFamily, FontWeight fontWeight, FontStyle fontStyle)
Parameters:textstring

The text string to be measured.

fontSizedouble

The font size of the text, measured in points.

fontFamilyFontFamily

The font family to be used for the text.

fontWeightFontWeight

The weight of the font, which can affect the width of the text measurement.

fontStyleFontStyle

The style of the font, such as italic or normal.

Returns:

BoxMeasurementInfo

The width of the measured text in pixels.

Measures the layout of a specified text string using the given measurement parameters.

C#
public static BoxMeasurementInfo Measure(string text, double fontSize, FontFamily fontFamily)
Parameters:textstring

The text string to measure.

fontSizedouble

The current font size.

fontFamilyFontFamily

The font family that determines the rendering of the text.

Returns:

BoxMeasurementInfo

A BoxMeasurementInfo object containing the measurement results.

Measures the layout of a specified text string within a given span and at a specified substring position.

C#
public static BoxMeasurementInfo Measure(string text, Span span, SubStringPosition subStringPosition = 0)
Parameters:textstring

The text string to be measured.

spanSpan

The span in which the text is measured.

subStringPositionSubStringPosition

The position within the substring to measure.

Returns:

BoxMeasurementInfo

The calculated size of the measured text as a Size object.