PeachDrawing.Text
PeachDrawing.Text.Layout
LineFlow Class
A paragraph laid out one line at a time in the room its caller gives each line: the tier for a caller that owns what the paragraph flows around (floats, columns, pages, a retry when a line’s height grows), where Layout(double) is for one that has a width and nothing else.
public sealed class LineFlow
Inheritance System.Object → LineFlow
Remarks
TryNext(FlowCursor, LineSpace, LineBox, FlowCursor) is a function of the paragraph, the cursor and the space and nothing else: it never changes its inputs, keeps no state, and gives the same line for the same arguments however the calls are ordered, so a caller replaces an undo of its own by calling it again with an earlier cursor. It can be called from several threads.
What the flow leaves to its caller: MaxLines (the caller decides how many lines there are; TextOverflow still cuts a line that overflows its space), where the next line’s top is (the height of the line laid out is Height), and the indent (see GetIndent(FlowCursor)). The limit on hyphenating the last full line takes the width of the space being laid out, less the indent of a line that is not indented, for the room of the next line, whose space is not known, and tab stops are measured from the start edge of the space plus the indent, not from the edge of a block that a float narrowed the space of. A line’s runs are placed in layout coordinates, at the space’s left edge.
| Properties | |
|---|---|
| Paragraph | The paragraph that flows. |
| Start | The cursor at the start of the paragraph, which is also default(FlowCursor). |
| Methods | |
|---|---|
| GetIndent(FlowCursor) | How far the line that starts at cursor is indented by the paragraph’s TextIndent: the first line, the lines after a forced break, and the other lines, as the style says. A caller that follows the style passes this as the Indent of the line’s space. |
| TryNext(FlowCursor, LineSpace, LineBox, FlowCursor) | Lays out the line that starts at cursor in space, and finds where the line after it starts. |