Commit graph

4 commits

Author SHA1 Message Date
Simon Hausmann
f1fb451791 Make the line break iterators implement Clone
This is needed in the future to be able to roll back state within the
line breaking when we can't fit even a single word into the line and
have to go back to fitting glyph by glyph.

For the unicode line break iterator the clone is a little more complicated.
The iterator is clone, but the type is anonymous. I first had an
implementation to moved the iterator into a closure, which was cloned
via another control closure. But that's complicated and still involves
allocating the various bits & pieces the closure captures.

So instead the simpler solution used here is to allocate the breaks
into a shared vector.
2022-05-13 17:33:01 +02:00
Simon Hausmann
4765cd3c40 Fix inconsistency in line break iterators
The unicode linebreak iterator always produces a mandatory break at end
of text.  This is not only confusing, but also inconsistent with the
simple line break iterator and with trailing spaces it could cause the
line break algorithm to emit empty lines at the end of text.
2022-05-13 17:33:01 +02:00
Simon Hausmann
1d1b13e4d6 Clean up line break "abstraction"
Use unicode-linebreak's enum directly and ony use a custom enum in the fake
module.
2022-03-10 10:51:32 +01:00
Simon Hausmann
35f245687a Make it possible to build the text layout without unicode linebreak tables 2022-03-10 10:51:32 +01:00