Unicode grapheme boundaries
HPDFUnicodeTextBoundary implements 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 requiring 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 returns 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 while consuming each scalar, including for empty input
Rich field wrapping
An overwide word in a multiline wrapped rich field is divided 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 remains 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 supply 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 remain 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 compare 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 behavior