go-text / typesetting

High quality text shaping in pure Go.
Other
88 stars 11 forks source link

[segmenter] Add word segmentation #134

Closed benoitkugler closed 5 months ago

benoitkugler commented 5 months ago

This PR adds support for breaking text on words. The entry point is the new WordIterator type and the related Segmenter.WordIterator() method.

My personal use case is to detect words when doing hyphenation.

For other uses cases, it might for example be useful to implement functionality such as "Select current word".

Note that we also have some (minor) changes on generated data since I've updated the Unicode version to 15.1.