Table of Contents

Method GetLengthThatFits

Namespace
Terminal.Gui
Assembly
Terminal.Gui.dll

GetLengthThatFits(string, int, int, TextDirection)

Gets the number of the Runes in the text that will fit in width.

public static int GetLengthThatFits(string text, int width, int tabWidth = 0, TextDirection textDirection = TextDirection.LeftRight_TopBottom)

Parameters

text string

The text.

width int

The width.

tabWidth int

The width used for a tab.

textDirection TextDirection

The text direction.

Returns

int

The index of the text that fit the width.

Remarks

This API will return incorrect results if the text includes glyphs whose width is dependent on surrounding glyphs (e.g. Arabic).

GetLengthThatFits(List<Rune>, int, int, TextDirection)

Gets the number of the Runes in a list of Runes that will fit in width.

public static int GetLengthThatFits(List<Rune> runes, int width, int tabWidth = 0, TextDirection textDirection = TextDirection.LeftRight_TopBottom)

Parameters

runes List<Rune>

The list of runes.

width int

The width.

tabWidth int

The width used for a tab.

textDirection TextDirection

The text direction.

Returns

int

The index of the last Rune in runes that fit in width.

Remarks

This API will return incorrect results if the text includes glyphs whose width is dependent on surrounding glyphs (e.g. Arabic).