Enum CaretMove
How MoveCaret(TextPosition, CaretMove, float) moves a caret.
public enum CaretMove
Fields
LineDown = 9To the line below, keeping the preferred x.
LineEnd = 5To the end of the line's text, before its hard break.
LineStart = 4To the start of the line.
LineUp = 8To the line above, keeping the preferred x.
NextGrapheme = 0To the next grapheme cluster boundary in logical order.
NextWord = 2To the next word boundary (UAX #29).
ParagraphEnd = 7To the end of the text.
ParagraphStart = 6To the start of the text.
PreviousGrapheme = 1To the previous grapheme cluster boundary in logical order.
PreviousWord = 3To the previous word boundary (UAX #29).
Examples
// A click: the nearest caret position, then where to draw the caret.
TextPosition position = layout.HitTest(new System.Numerics.Vector2(40, 30));
Caret caret = layout.GetCaret(position);
CaretLine bar = caret.Primary; // x, top and bottom; Secondary at a bidi boundary
// Arrow keys: logical moves, and line moves that keep the column.
TextPosition right = layout.MoveCaret(position, CaretMove.NextGrapheme);
TextPosition down = layout.MoveCaret(position, CaretMove.LineDown, preferredX: bar.X);
// A selection: rectangles to fill, one per visually contiguous piece on each line.
IReadOnlyList<TextBounds> highlight = layout.GetSelectionRects(position.Index, down.Index);
Egami.Fonts.Unicode.TextSegment word = layout.GetWordBoundary(position.Index); // double-click