Method Format
Format(ustring, int, TextAlignment, bool, bool, int, TextDirection)
Reformats text into lines, applying text alignment and optionally wrapping text to new lines on word boundaries.
public static List<ustring> Format(ustring text, int width, TextAlignment talign, bool wordWrap, bool preserveTrailingSpaces = false, int tabWidth = 0, TextDirection textDirection = TextDirection.LeftRight_TopBottom)
Parameters
textustringwidthintThe width to bound the text to for word wrapping and clipping.
talignTextAlignmentSpecifies how the text will be aligned horizontally.
wordWrapboolIf
true, the text will be wrapped to new lines as need. Iffalse, forces text to fit a single line. Line breaks are converted to spaces. The text will be clipped towidthpreserveTrailingSpacesboolIf
trueand 'wordWrap' also true, the wrapped text will keep the trailing spaces. Iffalse, the trailing spaces will be trimmed.tabWidthintThe tab width.
textDirectionTextDirectionThe text direction.
Returns
- List<ustring>
A list of word wrapped lines.
Remarks
An empty text string will result in one empty line.
If width is 0, a single, empty line will be returned.
If width is int.MaxValue, the text will be formatted to the maximum width possible.
Format(ustring, int, bool, bool, bool, int, TextDirection)
Reformats text into lines, applying text alignment and optionally wrapping text to new lines on word boundaries.
public static List<ustring> Format(ustring text, int width, bool justify, bool wordWrap, bool preserveTrailingSpaces = false, int tabWidth = 0, TextDirection textDirection = TextDirection.LeftRight_TopBottom)
Parameters
textustringwidthintThe width to bound the text to for word wrapping and clipping.
justifyboolSpecifies whether the text should be justified.
wordWrapboolIf
true, the text will be wrapped to new lines as need. Iffalse, forces text to fit a single line. Line breaks are converted to spaces. The text will be clipped towidthpreserveTrailingSpacesboolIf
trueand 'wordWrap' also true, the wrapped text will keep the trailing spaces. Iffalse, the trailing spaces will be trimmed.tabWidthintThe tab width.
textDirectionTextDirectionThe text direction.
Returns
- List<ustring>
A list of word wrapped lines.
Remarks
An empty text string will result in one empty line.
If width is 0, a single, empty line will be returned.
If width is int.MaxValue, the text will be formatted to the maximum width possible.