Unicode grapheme boundaries

HPDFUnicodeTextBoundary delivers Unicode 17.0.0 default extended grapheme clusters using the checked-in Grapheme_Cluster_Break, Indic_Conjunct_Break and Extended_Pictographic properties

The portable Pascal implementation handles combining marks, Hangul, Indic linker sequences, emoji ZWJ sequences and paired regional indicators without needing a GUI or a segmentation DLL

Offsets count UTF-16 code units from zero and include both the start and end of the text; empty text yields the single offset zero

Input must contain paired UTF-16 surrogates, and the caller supplies a positive code-unit budget up to 1048576; the default is 65535

Cancellation is checked before allocation and whilst consuming each scalar, including for empty input

Rich field wrapping

An overwide word in a multiline wrapped rich field is split at complete extended grapheme clusters and measured with the selected font and spacing

Each fragment preserves original V and RV values, actual Unicode mappings and the paragraph alignment; an indivisible cluster wider than the rectangle stays intact and is clipped

Fragment widths are checked after shaping, including joining forms that widen when shaped separately; divisible overflows are split again at complete clusters

Complex-script painting continues to use HarfBuzz and FriBidi; grapheme segmentation does not provide glyph shaping or paragraph bidirectional layout

Default Unicode line-break opportunities are available through the same portable unit; wrapping words across style boundaries and mixed-style paragraph bidi are still separate active targets

Conformance

Run Tests/Linux/Run-UnicodeGraphemeAcceptance.sh or the Windows portable test runner with HotPDFUnicodeGraphemeTests and Tests/Linux/resources

The tests consume all 766 official Unicode 17 GraphemeBreakTest cases and check every published boundary in UTF-16 units

Build-UnicodeTextBoundaryTables.py deterministically rebuilds the compiled range tables from the existing pinned UCD data

Unicode 17 text segmentation rules · Boundary function · Rich field behaviour