Ability to control where line breaks appear
That is, something like the word-break CSS property. Right now, Parley breaks all lines at word boundaries (there's logic to insert "emergency line breaks" if a single word overflows the maximum width, but it seems to be disabled).
For egui, we need to be able to customize where line breaks can appear (strictly at word boundaries, at word boundaries but falling back to letter boundaries, or at letter boundaries).
The line breaking code already has the first two variants implemented. But the second is disabled behind an if(constant) rather than bring controlled by a style.
For full CSS-level support, word-break will need to be a style property that can vary per-character. That would entail moving text analysis to the style builders' "build" methods, and adding a way for Swash to resolve it per-character (like how swash::partition calls a ShapeContext to select fonts). This would probably also mean that other non-Swash crates (like `icu_segmenter) couldn't be used since they don't have character-level support for these settings.
For egui, setting this as a per-layout property will suffice. Not sure how to best pass it as an option--neither of the builder methods take any layout-wide options. Maybe create a LayoutOptions struct and add it as an argument to the builder methods?
@valadaptive Could we always find all break points in the text analysis (but categorise them depending on which word-break setting(s) they apply to). And then selectively ignore some of them in layout depending on a span-specific style?
Maybe? I'm not sure to what extent the Unicode line-breaking algorithm can do that. I think it's stateful, and word-break: break-all says "treat certain line-breaking classes as if they were the ID class". I'm not sure if that implies that the rest of the line-breaking algorithm should do that too, or if its internal state can diverge depending on that. I'll probably have to look at how web browsers implement it.