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
text
stringThe text.
width
intThe width.
tabWidth
intThe width used for a tab.
textDirection
TextDirectionThe 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
intThe width.
tabWidth
intThe width used for a tab.
textDirection
TextDirectionThe text direction.
Returns
- int
The index of the last Rune in
runes
that fit inwidth
.
Remarks
This API will return incorrect results if the text includes glyphs whose width is dependent on surrounding glyphs (e.g. Arabic).