Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Static method: int WordWrap<TState>(EggsNode, TState, int, EggsML.EggMeasure<TState>, EggsML.EggRender<TState>, EggsML.EggNextLine<TState>, EggsML.EggNextState<TState>)

Declaration

public static int WordWrap<TState>(
    EggsNode node,
    TState initialState,
    int wrapWidth,
    EggsML.EggMeasure<TState> measure,
    EggsML.EggRender<TState> render,
    EggsML.EggNextLine<TState> advanceToNextLine,
    EggsML.EggNextState<TState> nextState
)

Summary

Word-wraps a given piece of EggsML, assuming that it is linearly flowing text. Newline (\n) characters can be used to split the text into multiple paragraphs. See remarks for the special meaning of +...+ and <...>.

Generic type parameters

TState The type of the text state that an EggsML can change, e.g. font or color.

Parameters

EggsNodenode The root node of the EggsML tree to word-wrap.
TStateinitialState The initial text state.
intwrapWidth The maximum width at which to word-wrap. This width can be measured in any unit, as long as measure uses the same unit.
EggsML.EggMeasure<TState>measure A delegate that measures the width of any piece of text.
EggsML.EggRender<TState>render A delegate that is called whenever a piece of text is ready to be rendered.
EggsML.EggNextLine<TState>advanceToNextLine A delegate that is called to advance to the next line.
EggsML.EggNextState<TState>nextState A delegate that determines how each EggsML tag character modifies the state (font, color etc.).

Returns

The maximum width of the text.

Remarks

  • The +...+ tag marks text that may not be broken by wrapping (effectively turning all spaces into non-breaking spaces).
  • The <...> tag marks a parameter to an immediately following tag. For example, if the input EggsML contains <X>{Foo}, the text “X” will be passed as the parameter to nextState when the { tag is processed.