For macOS and Windows we've had hard-coded fallbacks, but none for Linux
after the fontconfig removal. So go through the same fallback families
as when using fontique regularly, and add emoji as parley tries that
within.
This fixes picking up glyphs such as "←→↵⌫".
Fixes#9866
The material style defines a `StyleMetrics.default-font-family` which is
meant to be applied to `Window` element if not set by the user.
But it was mistakely sometimes applied to PopupWindow
Consider this code:
```slint
component MyPopup inherits PopupWindow {
Text { text: "Hello"; }
}
export component MainWindow inherits Window {
my_popup := MyPopup { }
}
```
First, we would process MyPopup: `apply_default_property_from_style`
wouldn't do anything, but the `lower_popups` pass would replace its
root with a Window builtin.
Second, we would process MainWindow: `apply_default_property_from_style`
would see that my_popup is using the Window as a builtin and would apply
default window properties from style, which it shouldn't.
In fact, `apply_default_property_from_style` should only apply default
for elements that are directly using the builtin, not a component that
inherits from that builtin, as these property should have been already
set.
Biome was raising this error:
> A "floating" Promise was found, meaning it is not properly handled and
> could lead to ignored errors or unexpected behavior.
Biome is of course right, so handle errors by logging them.
* ModalNavigationDrawer: add possibility to react on selection changes of group and item simultaneously like in NavigationDrawer
* Add arguments and their description to the documentation
* align style
50GB of caches in branches is still being created. This doesn't
eliminate them all but makes a decent dent. This stops the more useful
master branch cache being evicted.
* Use htmlparser
* Parse color values
* Cargo fmt
* Use imported Color
* Actually handle colors via overrides
* Check that the tags match
* Use color parsing feature
* Make htmlparser optional
* Error handling
* [autofix.ci] apply automated fixes
* debug_log!
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
It's just built in the nightly. On macOS in the CI it's built twice, once as bin and once as lib, with a total of 600seconds according to cargo-timings.
* Move color_parsing to common
* [autofix.ci] apply automated fixes
* Fixes
* Change how feature flags work
* Use std feature for common in compiler
* Add color-parsing feature instead
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* must be format!() instead of format()
* line 1192 uses a debug_name local variable, which got removed
Amends commit e11015e7b3
("Two way binding with struct for the interpreter")
Servo's script crate uses
js = { package = "mozjs", git = "https://github.com/servo/mozjs" }
which means it would pick mozjs from master. Inside servo this works
because of the present `Cargo.lock` file that pins it. But the version
of servo we're using doesn't compile with the master branch of mozjs.
Unfortunately the `[patch]` section in `Cargo.toml` can't just change
the revision, only if also the URL changes. So point mozjs to a fork of
ours and then we can pin the correct version that servo also uses.
* parley: Move the code for creating the ranged builders into a separate struct
This makes it easier to see what's needed for create the builders and reduces the lines of code for the layout function.
* parley: Move the parley::Layout building into LayoutWithoutLineBreaksBuilder
That way we can make sure that the text applied to the ranged_builder and the final layout is the same.
* parley: Separate creation of parley layouts from applying the line breaks and positioning
In the future, once fully separated, we can cache the layout without the line breaks.
* parley: Simplify LayoutWithoutLineBreaksBuilder::build
We only need the contexts within, so remove the argument.
* parley: Move pixel size computation into LayoutWithoutLineBreaksBuilder constructor
That's the only place where we need to compute it.
* parley: Reduce fields in LayoutOptions
Remove font_request and stroke, as that's only needed in LayoutWithoutLineBreaksBuilder, which is now passed into layout().
This is, again, in preparation of further separating the creation of the layouts (mainly shaping) and the line breaking and positioning.
* parley: Separate text layout steps further
With this PR, text layout is now split into three phrases:
1. Set up parley
2. Create paragraphs of text with formatting applied - stored in essentially a vec of parley layouts. This step includes shaping.
3. Apply line breaking to the layouts. This step includes glyph positioning.
* parley: Move selection handling into LayoutWithoutLineBreaksBuilder
It's only needed there, and only set from draw_text_input.
* parley: Move text wrap into LayoutWithoutLineBreaksBuilder
* parley: Move LayoutOptions creations right to the call where needed
* parley: In draw_text() initialize variables closes to their use-site
* parley: In draw_text_input() initialize variables closer to their use-site
This is done with the exceptions of opportunities for early returns, as those can then also avoid unnecessary property dependencies.
* parley: In text_size(), improve localty if variable declaration and use-site slightly
* parley: Improve variable locality in link_under_cursor
* parley: Improve variable locality in text_input_cursor_rect_for_byte_offset
* parley: Improve variable locality in text_input_byte_offset_for_position
* parley: Avoid unnecessary pixel_size computation in text_input_cursor_rect_for_byte_offset
* parley: Simplify cursor drawing code
Instead, hide access to the string behind a RenderString trait.
The objective in the future is to cache the layout, which means that we need to query the text and other properties only if the cache is dirty.