Method GetLengthThatFits
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
textstringThe text.
widthintThe width.
tabWidthintThe width used for a tab.
textDirectionTextDirectionThe 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
runesList<Rune>The list of runes.
widthintThe width.
tabWidthintThe width used for a tab.
textDirectionTextDirectionThe text direction.
Returns
- int
The index of the last Rune in
runesthat fit inwidth.
Remarks
This API will return incorrect results if the text includes glyphs whose width is dependent on surrounding glyphs (e.g. Arabic).