Commit graph

1504 commits

Author SHA1 Message Date
Olivier Goffart
c0be4cd5d6 Fix tests/screenshots/cases/software/basic/text-clipped.slint
Some checks are pending
CI / build_and_test (ubuntu-22.04, 1.88) (push) Blocked by required conditions
CI / build_and_test (ubuntu-22.04, nightly) (push) Blocked by required conditions
CI / node_test (macos-14) (push) Blocked by required conditions
CI / node_test (ubuntu-22.04) (push) Blocked by required conditions
CI / node_test (windows-2022) (push) Blocked by required conditions
CI / python_test (macos-14) (push) Blocked by required conditions
CI / python_test (ubuntu-22.04) (push) Blocked by required conditions
CI / cpp_test_driver (macos-14) (push) Blocked by required conditions
CI / cpp_test_driver (ubuntu-22.04) (push) Blocked by required conditions
CI / cpp_test_driver (windows-2022) (push) Blocked by required conditions
CI / cpp_cmake (macos-14, 1.88) (push) Blocked by required conditions
CI / cpp_cmake (ubuntu-22.04, stable) (push) Blocked by required conditions
CI / cpp_cmake (windows-2022, nightly) (push) Blocked by required conditions
CI / cpp_package_test (push) Blocked by required conditions
CI / vsce_build_test (push) Blocked by required conditions
CI / mcu (pico2-st7789, thumbv8m.main-none-eabihf) (push) Blocked by required conditions
CI / mcu (stm32h735g, thumbv7em-none-eabihf) (push) Blocked by required conditions
CI / mcu-embassy (push) Blocked by required conditions
CI / ffi_32bit_build (push) Blocked by required conditions
CI / docs (push) Blocked by required conditions
CI / wasm (push) Blocked by required conditions
CI / wasm_demo (push) Blocked by required conditions
CI / tree-sitter (push) Blocked by required conditions
CI / updater_test (0.3.0) (push) Blocked by required conditions
CI / fmt_test (push) Blocked by required conditions
CI / esp-idf-quick (push) Blocked by required conditions
CI / android (push) Blocked by required conditions
CI / miri (push) Blocked by required conditions
CI / test-figma-inspector (push) Blocked by required conditions
CI / material-components (push) Blocked by required conditions
It uses NaN in one of the coordinate.
It used to be fine because we would rely on the tracker to know if
anything had changed.
But now that we always compare the rectangle and NaN is always != NaN,
we would redraw too much for this test
2025-10-08 21:08:37 +02:00
Olivier Goffart
2f762cec96 partial_renderer: don't visit children of clipped item
No chance we find something dirty there
2025-10-08 21:08:37 +02:00
Olivier Goffart
04b102590e Do not re-query the geometry for the clip 2025-10-08 21:08:37 +02:00
Olivier Goffart
b8abb51c28 Remove Text's bounding rect implementation
Since every renderer is now always clipping the text, we don't need to
account for out of bound drawing.

The other optimization of trying not to draw things if the bounding box
is smaller is not really a good one since computing the bounding box is
itself too expensive and not cached.
2025-10-08 21:08:37 +02:00
Olivier Goffart
bd39da670d partial_renderer: Save memory by not having a tracker for the geometry
We just always query all the geometry anyway
2025-10-08 21:08:37 +02:00
Olivier Goffart
45abc7a627 partial_renderer: Separate the geometry tracker from the rendering tracker
This way we avoid rendering when only the layout is dirty but didn't
actually change
2025-10-08 21:08:37 +02:00
Olivier Goffart
2f31a7f3fb refactor: Rename RenderingCache to PartialRenderingCache 2025-10-08 21:08:37 +02:00
Olivier Goffart
11208758f0 core: Refactor the partial renderer in its own module 2025-10-08 21:08:37 +02:00
Ashley
e5dd53b6c2
parley: make font_size a PhysicalLength (#9672) 2025-10-09 03:47:03 +13:00
Tobias Hunger
cd50b41965
internal: Cargo + typo fixes (#9665)
* internal: Cargo + typo fixes

No intended change of behavior :-)

* Update internal/core/item_tree.rs

Co-authored-by: Olivier Goffart <olivier.goffart@slint.dev>

* Update internal/core/item_tree.rs

Co-authored-by: Olivier Goffart <olivier.goffart@slint.dev>

---------

Co-authored-by: Olivier Goffart <olivier.goffart@slint.dev>
2025-10-08 16:33:07 +02:00
Simon Hausmann
20949ac769 parley: Fix TextInput::wrap not respected
Remove the Default impl from LayoutOptions (since it's private) and forward all fields necessary.
2025-10-08 16:27:13 +02:00
Simon Hausmann
35adfe1d48 parley: Fix horizontal alignment for text input elements
Fixes #9675
2025-10-08 16:27:13 +02:00
Olivier Goffart
8ce8a94a26 Rename scale* property to transform-scale*
Some checks are pending
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, beta) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, stable) (push) Blocked by required conditions
CI / build_and_test (ubuntu-22.04, nightly) (push) Blocked by required conditions
CI / node_test (macos-14) (push) Blocked by required conditions
CI / node_test (ubuntu-22.04) (push) Blocked by required conditions
CI / node_test (windows-2022) (push) Blocked by required conditions
CI / python_test (macos-14) (push) Blocked by required conditions
CI / python_test (ubuntu-22.04) (push) Blocked by required conditions
CI / python_test (windows-2022) (push) Blocked by required conditions
CI / cpp_test_driver (macos-14) (push) Blocked by required conditions
CI / cpp_test_driver (ubuntu-22.04) (push) Blocked by required conditions
CI / cpp_test_driver (windows-2022) (push) Blocked by required conditions
CI / cpp_cmake (macos-14, 1.88) (push) Blocked by required conditions
CI / cpp_cmake (ubuntu-22.04, stable) (push) Blocked by required conditions
CI / cpp_cmake (windows-2022, nightly) (push) Blocked by required conditions
CI / mcu (pico-st7789, thumbv6m-none-eabi) (push) Blocked by required conditions
CI / mcu (pico2-st7789, thumbv8m.main-none-eabihf) (push) Blocked by required conditions
CI / mcu (stm32h735g, thumbv7em-none-eabihf) (push) Blocked by required conditions
CI / docs (push) Blocked by required conditions
CI / esp-idf-quick (push) Blocked by required conditions
CI / android (push) Blocked by required conditions
CI / miri (push) Blocked by required conditions
CI / test-figma-inspector (push) Blocked by required conditions
CI / cpp_package_test (push) Blocked by required conditions
CI / ffi_32bit_build (push) Blocked by required conditions
CI / vsce_build_test (push) Blocked by required conditions
CI / mcu-embassy (push) Blocked by required conditions
CI / updater_test (0.3.0) (push) Blocked by required conditions
CI / fmt_test (push) Blocked by required conditions
CI / material-components (push) Blocked by required conditions
This is to avoid reserving the `scale` property on every element which
is a common property name
2025-10-07 16:15:06 +02:00
Simon Hausmann
3acc16d365 parley: Implement support for TextOverflow::Clip
cc #8998
2025-10-07 14:33:45 +02:00
Ashley
2d0efb1dad
Parley: filter out empty ranges (#9641) 2025-10-07 23:48:26 +13:00
Simon Hausmann
01f510f027 parley: Upgrade to parley and fontique 0.6 2025-10-07 12:47:26 +02:00
Ashley
3894c3f6bb
Parley: Be extra careful about physical<->linear conversions (#9643)
* Be extra careful about physical<->linear conversions in sharedparley

* Change a bunch of functions
2025-10-07 22:34:38 +13:00
Montel Laurent
acc28e9b2b
Don't allow to undo/redo when textedit is readonly (#9609) 2025-10-07 09:04:56 +02:00
David Faure
23bd3ea308 Print property name when detecting a recursion (requires slint_debug_property) 2025-10-07 09:02:39 +02:00
Simon Hausmann
5450ce8de7 parley: Fix missing glyphs on macOS with FemtoVG renderer
Regression introduced with 7efa2886b8, where the fonts reported by GenericFamily::SystemUi can't be rendered.

This is I think a bug with FemtoVG that deserves a separate investigation, but for now: Fix the regression.
2025-10-06 19:55:13 +02:00
Simon Hausmann
9a4924fbbb wgpu: Added support for wgpu 27 with Skia
cc #9605
2025-10-06 19:10:31 +02:00
Simon Hausmann
49ae5041b6 CI: Fix build with MSRV
The life time extension doesn't seem to work yet with 1.88
2025-10-06 16:52:35 +02:00
Simon Hausmann
7efa2886b8 parley: Fix rendering of characters from the dingbats block
Fix default font selection to include GenericFamily::SystemUi. This typically expands to a list of ui fonts for use by user interfaces, which support these.

Fixes #9608
2025-10-06 14:53:41 +02:00
Simon Hausmann
5382141d7b core: Fix visibility of Context::external_translator
Commit 9917ab2df6 intended to make it
private, but accidentally made it public.
2025-10-06 11:27:01 +02:00
Simon Hausmann
0910024aeb qt: Use parley for text rendering
cc #9559
2025-10-06 09:10:21 +02:00
Simon Hausmann
d1ac15ac7e parley: Simplify stroke and brush interface towards the renderer
The renderer needs to provide a PlatformBrush type that encodes if it's a fill or a stroke. In exchange, the stroke style interpretation can be handled in renderer-independent code.
2025-10-01 11:48:26 +02:00
Simon Hausmann
993358dee4 parley: Fix passing the brush for stroking to the glyph rendering 2025-10-01 11:48:26 +02:00
Simon Hausmann
6529848954 parley: Move text_input_cursor_rect_for_byte_offset into the shared module
... and make the rest of sharedparley private.
2025-10-01 11:48:26 +02:00
Simon Hausmann
6848e4fd7b parley: Move implementation of text_input_byte_offset_for_position to shared module 2025-10-01 11:48:26 +02:00
Simon Hausmann
97235e6a42 parley: Move font-metrics computation function to shared module
For future sharing with the other renderers.
2025-10-01 11:48:26 +02:00
Simon Hausmann
a977f34a0b parley: Centralize font_size function
The implementation is independent from the renderer, so forward.
2025-10-01 11:48:26 +02:00
Simon Hausmann
b7ff7fc482 parley: Move GlyphRenderer trait into parley module 2025-10-01 11:48:26 +02:00
Simon Hausmann
539e99aeca parley: Fix foreground text selection color
Use a range with a brush on the ranged builder to apply a different text color for the selection.

Fixes #9580
2025-10-01 11:48:26 +02:00
Simon Hausmann
215c67b0e2 parley: Fixed size of the text cursor
We run parley in physical coordinates, while text_cursor_width() is in logical pixels.
2025-10-01 11:48:26 +02:00
Simon Hausmann
850358697d parley: Move text input rendering out of the FemtoVG item renderer into the to-be-shared parley module 2025-10-01 11:48:26 +02:00
Simon Hausmann
7c55402f58 parley: Introduce abstraction in the item renderer to reduce text drawing to glyph drawing 2025-10-01 11:48:26 +02:00
Simon Hausmann
6cc17639a3 parley: Simplify glyph elision handling
We can use a regular glyph iterator for all lines expect the last one, only for that one we need the special one. This eliminates the need to check for the last line for each single glyph.
2025-09-29 19:19:16 +02:00
Simon Hausmann
947827dac1 parley: Move more of the line and run rendering logic into sharedparley
This will allow for more code-reuse in the other renderers.
2025-09-29 19:19:16 +02:00
Simon Hausmann
86878a9487 Merge branch 'master' of https://github.com/slint-ui/slint into feature/fontique
Some checks are pending
CI / node_test (macos-14) (push) Blocked by required conditions
CI / node_test (ubuntu-22.04) (push) Blocked by required conditions
CI / node_test (windows-2022) (push) Blocked by required conditions
CI / python_test (macos-14) (push) Blocked by required conditions
CI / python_test (ubuntu-22.04) (push) Blocked by required conditions
CI / python_test (windows-2022) (push) Blocked by required conditions
CI / cpp_test_driver (macos-14) (push) Blocked by required conditions
CI / cpp_test_driver (ubuntu-22.04) (push) Blocked by required conditions
CI / cpp_test_driver (windows-2022) (push) Blocked by required conditions
CI / cpp_cmake (macos-14, 1.85) (push) Blocked by required conditions
CI / cpp_cmake (ubuntu-22.04, stable) (push) Blocked by required conditions
CI / cpp_cmake (windows-2022, nightly) (push) Blocked by required conditions
CI / cpp_package_test (push) Blocked by required conditions
CI / vsce_build_test (push) Blocked by required conditions
CI / mcu (pico-st7789, thumbv6m-none-eabi) (push) Blocked by required conditions
CI / mcu (pico2-st7789, thumbv8m.main-none-eabihf) (push) Blocked by required conditions
CI / mcu (stm32h735g, thumbv7em-none-eabihf) (push) Blocked by required conditions
CI / mcu-embassy (push) Blocked by required conditions
CI / wasm_demo (push) Blocked by required conditions
CI / tree-sitter (push) Blocked by required conditions
CI / android (push) Blocked by required conditions
CI / ffi_32bit_build (push) Blocked by required conditions
CI / docs (push) Blocked by required conditions
CI / wasm (push) Blocked by required conditions
CI / updater_test (0.3.0) (push) Blocked by required conditions
CI / fmt_test (push) Blocked by required conditions
CI / esp-idf-quick (push) Blocked by required conditions
CI / miri (push) Blocked by required conditions
CI / test-figma-inspector (push) Blocked by required conditions
CI / material-components (push) Blocked by required conditions
Conflicts:
	Cargo.toml
2025-09-29 12:56:42 +02:00
Simon Hausmann
7f4be51ad5 core: tidy up re-export of tr
Only export the one item we need, the Translator trait.
2025-09-29 12:50:22 +02:00
Simon Hausmann
4d3b9a72c3 core: Add comment about global_translation_property() use 2025-09-29 12:50:22 +02:00
Simon Hausmann
91ca250146 core: Remove unused variable declaration 2025-09-29 12:50:22 +02:00
Simon Hausmann
9917ab2df6 core: Avoid crate-wide access to SlintContextInner::external_translator
There's a setter and a getter that's public.
2025-09-29 12:50:22 +02:00
Simon Hausmann
60d8897c8c core: re-export the tr crate when the tr feature is activated 2025-09-29 12:50:22 +02:00
Simon Hausmann
2bbe5e8786 Python: Added support for run-time translations from .slint files
Fixes #7956
2025-09-29 12:50:22 +02:00
LouisBouch
ca4e337146
add space-evenly alignment to layout (#9545)
Add space-evenly to the layout options. These already included
space-around, space-between, start, end, etc.
2025-09-29 12:41:31 +02:00
Simon Hausmann
280594680a parley: Apply elision only on the last line
When breaking multiples lines of text and the last line can't be broken anymore but exceeds the available width *and* overflow handling is set to elide, *then* apply the elision glyph substitution.

Also, centralize more of this inside just one glyph iterator, so that
re-use in the other renderers will be trivial. This also avoids one
extra vec allocation when collecting the glyphs.
2025-09-29 11:40:43 +02:00
Simon Hausmann
b8354af92e Merge branch 'master' of https://github.com/slint-ui/slint into feature/fontique
Some checks failed
CI / vsce_build_test (push) Has been cancelled
CI / mcu (pico-st7789, thumbv6m-none-eabi) (push) Has been cancelled
CI / mcu (pico2-st7789, thumbv8m.main-none-eabihf) (push) Has been cancelled
CI / mcu (stm32h735g, thumbv7em-none-eabihf) (push) Has been cancelled
CI / mcu-embassy (push) Has been cancelled
CI / ffi_32bit_build (push) Has been cancelled
CI / docs (push) Has been cancelled
CI / wasm (push) Has been cancelled
CI / wasm_demo (push) Has been cancelled
CI / tree-sitter (push) Has been cancelled
CI / test-figma-inspector (push) Has been cancelled
CI / material-components (push) Has been cancelled
CI / node_test (macos-14) (push) Has been cancelled
CI / node_test (ubuntu-22.04) (push) Has been cancelled
CI / node_test (windows-2022) (push) Has been cancelled
CI / python_test (macos-14) (push) Has been cancelled
CI / python_test (ubuntu-22.04) (push) Has been cancelled
CI / python_test (windows-2022) (push) Has been cancelled
CI / cpp_test_driver (macos-14) (push) Has been cancelled
CI / cpp_test_driver (ubuntu-22.04) (push) Has been cancelled
CI / cpp_test_driver (windows-2022) (push) Has been cancelled
CI / cpp_cmake (macos-14, 1.85) (push) Has been cancelled
CI / cpp_cmake (ubuntu-22.04, stable) (push) Has been cancelled
CI / cpp_cmake (windows-2022, nightly) (push) Has been cancelled
CI / cpp_package_test (push) Has been cancelled
CI / updater_test (0.3.0) (push) Has been cancelled
CI / fmt_test (push) Has been cancelled
CI / esp-idf-quick (push) Has been cancelled
CI / android (push) Has been cancelled
CI / miri (push) Has been cancelled
2025-09-27 17:23:20 +02:00
Ashley
e9d9b873df
feature/fontique - text elision (#9537)
Some checks are pending
CI / node_test (macos-14) (push) Blocked by required conditions
CI / node_test (ubuntu-22.04) (push) Blocked by required conditions
CI / node_test (windows-2022) (push) Blocked by required conditions
CI / python_test (macos-14) (push) Blocked by required conditions
CI / python_test (ubuntu-22.04) (push) Blocked by required conditions
CI / python_test (windows-2022) (push) Blocked by required conditions
CI / cpp_test_driver (macos-14) (push) Blocked by required conditions
CI / cpp_test_driver (ubuntu-22.04) (push) Blocked by required conditions
CI / cpp_test_driver (windows-2022) (push) Blocked by required conditions
CI / cpp_cmake (macos-14, 1.85) (push) Blocked by required conditions
CI / cpp_cmake (ubuntu-22.04, stable) (push) Blocked by required conditions
CI / cpp_cmake (windows-2022, nightly) (push) Blocked by required conditions
CI / cpp_package_test (push) Blocked by required conditions
CI / vsce_build_test (push) Blocked by required conditions
CI / mcu (pico-st7789, thumbv6m-none-eabi) (push) Blocked by required conditions
CI / mcu (pico2-st7789, thumbv8m.main-none-eabihf) (push) Blocked by required conditions
CI / mcu (stm32h735g, thumbv7em-none-eabihf) (push) Blocked by required conditions
CI / mcu-embassy (push) Blocked by required conditions
CI / ffi_32bit_build (push) Blocked by required conditions
CI / docs (push) Blocked by required conditions
CI / wasm (push) Blocked by required conditions
CI / wasm_demo (push) Blocked by required conditions
CI / tree-sitter (push) Blocked by required conditions
CI / updater_test (0.3.0) (push) Blocked by required conditions
CI / fmt_test (push) Blocked by required conditions
CI / esp-idf-quick (push) Blocked by required conditions
CI / android (push) Blocked by required conditions
CI / miri (push) Blocked by required conditions
CI / test-figma-inspector (push) Blocked by required conditions
CI / material-components (push) Blocked by required conditions
* Don't break when not wrapping

* Handle elipsis in draw_glyphs

* Add some nice QOL functions to sharedparley
2025-09-27 01:19:00 +12:00
Ashley
13623bc152
feature/fontique: switch femtovg to parley (#9466)
Some checks are pending
CI / build_and_test (ubuntu-22.04, nightly) (push) Blocked by required conditions
CI / node_test (ubuntu-22.04) (push) Blocked by required conditions
CI / node_test (windows-2022) (push) Blocked by required conditions
CI / python_test (macos-14) (push) Blocked by required conditions
CI / python_test (ubuntu-22.04) (push) Blocked by required conditions
CI / python_test (windows-2022) (push) Blocked by required conditions
CI / cpp_cmake (ubuntu-22.04, stable) (push) Blocked by required conditions
CI / cpp_test_driver (macos-14) (push) Blocked by required conditions
CI / cpp_test_driver (ubuntu-22.04) (push) Blocked by required conditions
CI / cpp_test_driver (windows-2022) (push) Blocked by required conditions
CI / cpp_cmake (macos-14, 1.85) (push) Blocked by required conditions
CI / cpp_cmake (windows-2022, nightly) (push) Blocked by required conditions
CI / cpp_package_test (push) Blocked by required conditions
CI / vsce_build_test (push) Blocked by required conditions
CI / mcu (pico-st7789, thumbv6m-none-eabi) (push) Blocked by required conditions
CI / mcu (pico2-st7789, thumbv8m.main-none-eabihf) (push) Blocked by required conditions
CI / mcu (stm32h735g, thumbv7em-none-eabihf) (push) Blocked by required conditions
CI / mcu-embassy (push) Blocked by required conditions
CI / ffi_32bit_build (push) Blocked by required conditions
CI / docs (push) Blocked by required conditions
CI / wasm (push) Blocked by required conditions
CI / wasm_demo (push) Blocked by required conditions
CI / tree-sitter (push) Blocked by required conditions
CI / updater_test (0.3.0) (push) Blocked by required conditions
CI / fmt_test (push) Blocked by required conditions
CI / esp-idf-quick (push) Blocked by required conditions
CI / android (push) Blocked by required conditions
CI / miri (push) Blocked by required conditions
CI / test-figma-inspector (push) Blocked by required conditions
CI / material-components (push) Blocked by required conditions
* Parlay init

* Start on femtovg

* Cargo fmt

* Decimate fonts.rs

* Use fill_glyphs

* [autofix.ci] apply automated fixes

* Use positioned_glyphs instead

* Clean up a little

* Format

* [autofix.ci] apply automated fixes

* Few fixes

* [autofix.ci] apply automated fixes

* More small changes

* Clean up

* [autofix.ci] apply automated fixes

* Display text cursor

* Handle text_input_cursor_rect_for_byte_offset

* stoke glyphs

* Handle text selections

* Stroke selection as well

* Fix wierd cargo.toml padding

* Move selection and stroking to brush settings

* Removed commented out code

* [autofix.ci] apply automated fixes

* Cursor sizing

* [autofix.ci] apply automated fixes

* Mark unused variables

* _scale -> scale

* Handle a lot more layout options

* Use the parley cursor

* Removed unused PhysicalPoint

* Start combining stuff WIP

* Move things into i_slint_core::textlayout::sharedparley

* [autofix.ci] apply automated fixes

* Go back to splitting paragraphs correctly

* Handle font_metrics via ttf_parser

* Move (lack of) overflow handling to sharedparley

* [autofix.ci] apply automated fixes

* impl Deref for Layout

* Be more explit about the width passed to layout being physical

* Cargo fmt, rename fonts to font_cache

* Use a thread local for layout context

* Use parley selection

* fix femtovg wgpu

* Switch femtovg branch

* max_physical_width -> max_width

* Box contexts

* [autofix.ci] apply automated fixes

* Fallback to GenericFamily::SansSerif if no font is set

* Add paint.set_font_size

* Use max_physical_height

* Fix text_size to return correct logical sizes

* Use femtovg from crates.io

* Fix C++ build

The `sharedparley` module declares a public `Layout` struct, which
clashes with the `Layout` struct we use in the C++ API. The former
however is entirely internal to Rust, so we can instruct cbindgen to
ignore the module.

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
2025-09-26 02:48:48 +12:00