KiteStructuredText
Format-neutral structured text for a KitePage: the minimal blocks → lines → text model a viewer needs for extraction, search highlights and selection, without committing to a handler's internals.
All geometry is in the page's DISPLAY space: the top-left-origin, y-down [0, displayWidth] x [0, displayHeight] box that KitePage.displayToDeviceBase maps onto. Because KiteRectangle names its fields PDF-style (y-up), display rectangles here store the y-MIN (the edge nearest the page top) in KiteRectangle.bottom and the y-MAX in KiteRectangle.top, keeping width/height positive.
Properties
Functions
Where a selection that starts at the flattened char index begins, or where one that ends at it ends when after is true: the char's logical edge, as a caret across its line. Lines keep their own direction, so the start of a right-to-left run is its right edge, and a caret in a vertical line runs across the column. Null for an index with no char.
The flattened index of the char at a display-space point, or null when the point is on no text line. Within a line, x clamps to the nearest char, which is what a selection drag wants at the line's ends.
The text of the inclusive flattened range as a reader copies it. Blocks are separated by \n\n, and the lines of one block join as their KiteTextLine.end says: a paragraph the layout wrapped copies as one line, a word it hyphenated copies whole, and a break the text holds stays \n. Lines that end KiteLineEnd.HARD, as every fixed-layout line does, copy as textRange gives them.
Find needle in this page's text. Matches may cross line boundaries inside a block: a line break counts as one space, except after a line ending in a hyphen, which joins the halves directly with the hyphen dropped (so a hyphenated "compres-/sion" matches "compression"). Matches never cross block boundaries. Case-insensitive comparison uses per-position regionMatches, so indices stay aligned for any script.
search with an explicit page location in the current layout. The caller owns the page coordinate: structured text alone cannot recover its chapter or page. pageIndex keeps its caller-supplied meaning and may be -1 when unknown. Neither the location nor the quads are a content anchor that survives reflow.