Object “sizeMeasurement”

Object > NativeObject > SizeMeasurement

Allows to measure Text.

Type: SizeMeasurement extends NativeObject
Constructor: private
Singleton: sizeMeasurement
Namespace: tabris
Direct subclasses: None
JSX Support: No

See also:

JSX How to measure text with various parameters [► Run in Playground]

Methods

measureTexts(configs)

Note: this API is provisional and may change in a future release.

Measures the given text. The method returns a Promise which resolves to an array of {width: number, height: number}.

Parameter Type Description
configs Array<{text: string, font: FontValue, maxWidth: number, markupEnabled: boolean}> The text configurations to measure. A text configuration has to provide at least a text and fontSize property.

Returns: Promise<{width: number, height: number}>

measureTextsSync(configs)

Note: this API is provisional and may change in a future release.

Measures the given text. The method returns an array of {width: number, height: number}.

Parameter Type Description
configs Array<{text: string, font: FontValue, maxWidth: number, markupEnabled: boolean}> The text configurations to measure. A text configuration has to provide at least a text and fontSize property.

Returns: Array<{width: number, height: number}>