EnsureSelectionBoundaries
Forms, interaction, unicode
Description
Internal helper of TPDFlibFormSession that builds and caches the Unicode boundary tables for the current edit value
For fsuUnicodeCodePoint it scans the UTF-16 value and records one boundary per code point, treating a valid surrogate pair as a single supplementary code point and an unpaired surrogate as one standalone code point
For fsuGraphemeCluster it builds extended grapheme cluster boundaries so combining sequences and joined emoji remain indivisible
Each table starts with the boundary at zero and stores zero-based UTF-16 offsets, and a non-empty cached table is reused until InvalidateSelectionBoundaries clears it
The tables back every index conversion between UTF-16 code units, Unicode code points and grapheme clusters
Declaration
procedure EnsureSelectionBoundaries(
IndexUnit: TPDFlibFormSelectionUnit);
Parameters
| IndexUnit | Requested boundary table, fsuUnicodeCodePoint or fsuGraphemeCluster |
|---|
Example
Session.SetSelectionRange(1, 2, fsuUnicodeCodePoint);
Session.GetSelectionRange(fsuUTF16CodeUnit, Sel);
See also
InvalidateSelectionBoundaries, EnsureVisualCaretOrder, ClampTextLength, SetSelectionRange, GetSelectionRange, TPDFlibFormSelectionUnit, TPDFlibFormSession