Declaration
public static int WordWrap<TState>(
CuteNode node,
TState initialState,
int wrapWidth,
CuteML.CuteMeasure<TState> measure,
CuteML.CuteRender<TState> render,
CuteML.CuteNextLine<TState> advanceToNextLine,
CuteML.CuteNextState<TState> nextState
)
Summary
Word-wraps a given piece of CuteML, assuming that it is linearly flowing text. Newline (
\n
) characters can
be used to split the text into multiple paragraphs. The special
[+...]
tag marks text that may not be
broken by wrapping (effectively turning all spaces into non-breaking spaces).
Generic type parameters
TState |
The type of the text state that a tag can change, e.g. font or color. |
Parameters
CuteNode | node |
The root node of the CuteML tree to word-wrap. |
TState | initialState |
The initial text state. |
int | wrapWidth |
The maximum width at which to word-wrap. This width can be measured in any unit, as long as measure uses the same unit. |
CuteML.CuteMeasure<TState> | measure |
A delegate that measures the width of any piece of text. |
CuteML.CuteRender<TState> | render |
A delegate that is called whenever a piece of text is ready to be rendered. |
CuteML.CuteNextLine<TState> | advanceToNextLine |
A delegate that is called to advance to the next line. |
CuteML.CuteNextState<TState> | nextState |
A delegate that determines how each CuteML tag character modifies the state (font, color etc.). |
Returns
The maximum width of the text.