Separate the text shaping functionality from font metrics by having a
FontMetrics trait next to the TextShaper. AbstractFont is the combining
super trait. This allows eliminating the font height member from
TextParagraphLayout and improving the overall naming of fields and
types.
Finally, this prepares the API for composability of TextShaper for font
fallback handling.
Use the term glyph cluster instead of grapheme where we're dealing with
the glyphs for line breaking. Those may coincide with grapheme
boundaries, but aren't required to.
Replace the abstract glyph trait with a glyph struct. That way the text
layout code can operate properly on a struct with fields, instead of on
functions on a trait (some of which returning a mutable reference). The
input is a glyph with offset, advance, etc. - everything needed for the
layout and the output is a position along with the platform specific
glyph data.
Remove the font reference field anymore as it's not needed anymore and
remove the manual clone implementations. Those were needed because
otherwise the TextShaper trait would have to also support clone - as
[derive(Clone)] imposes that. Now we can impose that just on Glyph and
that's easy and makes sense.
Replace the lazy text shaping with an up-front shaping of all text. It
needs to be done eventually anyway, so by doing it in one go we can
avoid interior mutability and simplify the code overall.
Make ShapeBoundaries produce single offsets, there's no need for
ranges as the boundaries are contiguous.
In GraphemeCursor collect all boundaries in one go as text runs, to
simplify state handling. This will be needed anyway for recording bidi
runs in the future.
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.
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.
* janitor: Fix clippy error in textlayout.rs
This one is almost certainly a bug.
* janitor: clippy fixes in inline_expressions.rs
Clippy claims the original code was slower and less clean, so let's
change this.
Changing the constraint doesn't work on non-rezsizable window.
So first set the window as resizeable, then change the constraints, then
maybe remove the resizable flag
The flickable module was created to hold the implementation for the Flickable
at a time were all the items lived in the items.rs module.
Now that some items moved into sub modules of items, we can also move the Flickable
in such module, alongside its implementation
Do not send keyboard events to invisible widgets, reset the keyboard
focus instead.
That fixes#798 again with a bit less of a work-around. To properly fix
this we will need to make the tab widget (and probably others) more
intelligent though.
Remove the `parent_item` function. After the recent changes that did not
return an item anymore and since the item tree is exposed, this function
was only used to find the repeater a component was created by.
So replace the old function with a new one that only returns the parent
node in the parent component.
This saves a few lines of generated code that is not used anymore.
Co-authored-by: Simon Hausmann <hausmann@gmail.com>
This avoid repeating the enums both in the compiler and in
the runtime library, and register them in a bunch of other places.
So it should be easier to add enums and enum values
Since cbindgen doesn't see through the macro, generate the enum
manually
When resetting the binding, we need to mark dependent property as dirty.
It just hapenned that the current implementation always set all bindings
before starting to query the properties, so this problem was not seen
before. But there is an exception when setting the two_way bindings,
then we may set the binding after the property was querried because
setting a two way binding actually queries the property