Table of Contents

Enum CaretMove

Namespace
Egami.Fonts.Layout
Assembly
Egami.Fonts.dll
public enum CaretMove

Fields

LineDown = 9

To the line below, keeping the preferred x.

LineEnd = 5

To the end of the line's text, before its hard break.

LineStart = 4

To the start of the line.

LineUp = 8

To the line above, keeping the preferred x.

NextGrapheme = 0

To the next grapheme cluster boundary in logical order.

NextWord = 2

To the next word boundary (UAX #29).

ParagraphEnd = 7

To the end of the text.

ParagraphStart = 6

To the start of the text.

PreviousGrapheme = 1

To the previous grapheme cluster boundary in logical order.

PreviousWord = 3

To 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