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.
* 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>
* 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")
* 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.
During window initialization, Slint window properties (width/height)
are set incrementally, which can result in Surface::configure being
called with zero dimensions. This causes wgpu to panic with the error:
"Both Surface width and height must be non-zero."
This fix skips surface configuration when either dimension is zero,
following wgpu's recommendation to "wait to recreate the Surface
until the window has non-zero area."
As suggested in #9862 this PR adds support for FB Renderer Format DrmFourcc(BA24) in LinuxKMS.
Changelog: Added support for FB Renderer Format DrmFourcc(BA24) in LinuxKMS
Closes#9862
Instead of each caller obtaining the scale factor, the renderer can do that, too. This also eliminates the dependency to the scale factor where it's not needed, such as for the font metrics.
This line was added by mistake in a previous commit.
But the feature can't work for C++ and the interpreter for now because
they can't re-use the same binding.
It would also break for eust if there was another layer of two way
binding.
That's because `impl BindingCallable for TwoWayBindingWithMap` doesn't
(and can't) implement intercept_set_binding
The previous code would create many many lambda and if conditions which
would cause nesting to be way too high for big enums.
Also improve the C++ codegen for condition to use the ternary operator
when possible
Fixes#9954
* Add an open-url function
* Add cpp implementation
* Add workspace dep
* Add core::open_url function
* Remove pub use webbrowser
* Put open_url behind a flag
* [autofix.ci] apply automated fixes
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
No extra safety constraints that is not expressed in the type system
(eg, if they don't take any raw pointers)
Fix UB in slint_interpreter_value_to_array (The vector was already constructed in C++)
The comment says '...enabled here just so that we can make use of the
pre-built Skia libraries.' however 'macos' wasn't an included target.
Speeds up uncharted or initial runs.
* Add `stroke-line-join` for `Path`
* Add `LineJoin` enum
* Add `stroke-line-join` property for `Path`
* Set line_join in Skia and FemtoVG renders
* Set pen_join_style in Qt backend
* Add example test case
* Docs: Add `stroke-line-join` property for `Path`
Instead of always creating an array with fallbacks + 1 that's padded with SystemUi, create two arrays depending on the existence of a user-specified family.
Share the fallback to SansSerif/SystemUi across all the fontique/parley fallbacks and (most importantly for this fix) in embed_glyphs.rs set families on the query always as a list that ends up with the fallbacks, instead of just the family that could not be found.
Fixes#9879
... when there are two level of indirection, as it is the case with the
interpreter as it tries to create mapping to Value as one first level of
indirection