Simon Hausmann
4e18291290
Rename linebreak_ascii to linebreak_simple
...
It's not just strict ascii
2022-03-10 10:51:32 +01:00
Simon Hausmann
7cf5a6a197
Simplify line layout API
...
Use a struct for all the parameters
2022-03-10 10:51:32 +01:00
Simon Hausmann
5e9a3b8ed1
Remove unnecessary refcell/vec
2022-03-10 10:51:32 +01: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
004a09b64d
Fix incorrect comment in the "ascii" line breaker
...
Co-authored-by: Olivier Goffart <olivier.goffart@slint-ui.com>
2022-03-10 10:51:32 +01:00
Simon Hausmann
7ba8ea156b
Fix up small TODO comments
2022-03-10 10:51:32 +01:00
Simon Hausmann
51e0d17092
Add a test for elision
2022-03-10 10:51:32 +01:00
Simon Hausmann
33ae882506
Avoid shaping text twice per line when drawing paragraphs
...
Track the glyph range in the TextLine and use that to access the glyph buffer,
instead of calling shape_text() again.
2022-03-10 10:51:32 +01:00
Simon Hausmann
247847cb54
Avoid unnecessary glyph buffer re-allocations
...
Store the result of all text shaping calls in one glyph buffer when laying out a
a paragraph of text.
This paves the way of avoiding unnecessary shape_text calls when processing lines.
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
Simon Hausmann
187294c00e
Simplify glyph interface in TextShaper
...
* Impose no bounds on the associated Glyph type
* Report the byte offset only in shape_text - it doesn't belong into an aritrary glyph
* Move querying the advance into the TextShaper, where the MCU implementation can deal with missing glyphs
without storing fallback values in the Glyph type
2022-03-10 10:51:32 +01:00
Simon Hausmann
87431eea95
Make it possible to build without unicode-script
2022-03-10 10:51:32 +01:00
Simon Hausmann
38e26f25ef
Basic elision support
...
TODO:
* alignment for rtl/ltr
* elide only last line for multi-line
2022-03-10 10:51:32 +01:00
Simon Hausmann
8d4c645346
Change the paragraph text layout callback to take glyphs
...
This is needed in the future to avoid duplication shaping and
implementation of features like elision or letter spacing in a shared code.
2022-03-10 10:51:32 +01:00
Simon Hausmann
ff2b38eefb
Minor clean up in paragraph layout
...
Encapsulate the entire loop body in the process_line helper
2022-03-10 10:51:32 +01:00
Simon Hausmann
a947ec1441
Simplify glyph interface
...
The textlayout module does not need to impose the exact glyph struct layout.
This paves the way for glyph based rendering.
2022-03-10 10:51:32 +01:00
Simon Hausmann
42a0f605ad
Add an paragraph layout helper function to the corelib textlayout
...
The objective is to use this in the MCU backend and replace layout_text_lines() in the GL backend in the future.
2022-03-10 10:51:32 +01:00
Simon Hausmann
6748563dc6
Fix non-wrapped text with multiple break opportunities
2022-03-10 10:51:32 +01:00
Simon Hausmann
62d633a572
Add convenience function for measuring paragraph sizes
2022-03-10 10:51:32 +01:00
Simon Hausmann
72186cd891
Make the available width an option
2022-03-10 10:51:32 +01:00
Simon Hausmann
1a73460a6a
Add basic text layout module for use with the MCU
...
This is based on the unicode line breaking algorithm (uses crate for
that), which also supports forced line breaks. The shaping is generic,
so on the MCU side we can do without at first.
2022-03-10 10:51:32 +01:00
ogoffart
7b50791db4
Bump version number to 0.2.2
2022-03-10 08:48:33 +00:00
Olivier Goffart
bc38d31bcb
Save one property dependency when accessing dirty model
2022-03-07 19:06:23 +01:00
Olivier Goffart
24237377cf
Don't register dependencies when computing the dirty geometry
2022-03-07 19:06:23 +01:00
Olivier Goffart
2fd4b4ccfb
Print what property was marked as constant when we assert because of modifying non-const
2022-03-04 11:11:40 +01:00
Olivier Goffart
3703c862a0
Fix BorrowMutError panic
...
Introduced in commit b2caa75
Fixes #1010
2022-03-04 09:16:57 +01:00
Olivier Goffart
b2caa757e7
Partial renderer: Initial work
2022-03-03 14:58:48 +01:00
Olivier Goffart
b6ef333444
Rendering: put the clipping an a function in the ItemRenderer trait
...
This will allow partial updates
2022-03-03 14:58:48 +01:00
Simon Hausmann
583c7a1b80
Fix C++ build
...
With ImageInner::StaticTextures (the variant) and StaticTextures (the
struct), we need to disambiguate for the generated enum contructor
functions. This is done by prefixing the enum variant with their name.
2022-03-03 14:39:11 +01:00
Simon Hausmann
f1dae75d53
Fix interpreter ffi build
...
Commit 738ac0dc01
increased the size of the ImageInner::StaticTextures variant,
which breaks the size assertions in the interpreter ffi build.
This changes fixes that by reducing the size of the ImageInner variant again by
moving all the fields into a separate struct.
2022-03-03 14:04:45 +01:00
Simon Hausmann
738ac0dc01
mcu: scale images at compile time ( #966 )
...
Apply a scale factor to reduce the size of embedded images at compile
time.
2022-03-03 13:28:47 +01:00
Lukas Jung
c15b0e1486
Add focus and keyboard control to native/qt spinbox
2022-03-02 17:51:31 +01:00
Jared Moulton
b884a4ca19
Fix CI issues, remove references to replace-char, add a test, fix creation of string
2022-03-02 15:47:32 +01:00
Jared Moulton
fdbc8056b3
Add an option to draw *'s instead of characters for password fields
2022-03-02 15:47:32 +01:00
Simon Hausmann
5493b30d4d
Bump strum dependency
2022-02-28 08:53:00 +01:00
Tobias Hunger
f3feab1267
Implement ptr_eq for VWeak and PartialEq for Items ( #976 )
...
* Implement ptr_eq for VWeaks
Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
2022-02-21 17:45:18 +01:00
Tobias Hunger
6795d3ee00
Introduce a FocusEventResult enum ( #975 )
2022-02-21 17:43:41 +01:00
Simon Hausmann
ae2ee04c33
Make it possible to run unit tests in corelib standalone
...
We need to enable the compat-0-2-0 feature of the slint crate.
2022-02-21 16:30:15 +01:00
Olivier Goffart
c941946f49
Debug: make sure that more properties have debug_name
...
The global properties, and base properties were not named
This adds a Property::new_named regardless if debug is enabled or not
2022-02-18 17:40:17 +01:00
Simon Hausmann
f912ec7e6b
Fix scaling of glyphs and improve type safety in the MCU backend
...
The code was mixing logical and physical sizes, causing glyphs being
doubly scaled down. Instead, this patch introduces:
* Physical* and Logical* euclid length/size/rect aliases
* some extraction traits for getting the scalars in rects/sizes as lengths (until euclid has them
built-in)
* wrapper traits/types for safely extracting the physical font metrics the
compiler generates (i16)
* Fix a bug in the text height calculation where we failed to take the
descent into account
2022-02-17 15:07:57 +01:00
Tobias Hunger
7210ea5448
Fix doc strings
...
Use singular form when refering to one child only.
2022-02-17 13:06:00 +01:00
Tobias Hunger
f5ad73969f
Quieten some clippy warnings.
2022-02-17 09:36:16 +01:00
Simon Hausmann
07da5c1c36
janitor: Fix license headers
2022-02-15 15:55:41 +01:00
Simon Hausmann
304e06f758
Begin rasterizing glyphs for glyph embedding
...
Enable with `SLINT_EMBED_GLYPHS=1` and select sizes like
`SLINT_FONT_SIZES=12,16`
This change just puts the data structures in place, rasterizes a fixed
subset, embeds that into the rust generated code and calls a backend
function for registering the font that is unimplemented.
2022-02-15 15:52:24 +01:00
Olivier Goffart
f9fd523583
Update internal/core/items.rs
...
Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
2022-02-15 12:02:27 +01:00
Olivier Goffart
efd6c63b8e
Fix animation in the flickable
...
This is a regression since the introduciton of iteration_count which defaults
to 0 for animation started programatically
Also add a test.
Fix #951
2022-02-15 12:02:27 +01:00
Olivier Goffart
7a7a21ca54
Fix build with no_std
2022-02-14 16:21:31 +01:00
ogoffart
ecd0fb7ecd
Bump version number to 0.2.1
2022-02-10 16:25:28 +01:00
Olivier Goffart
40d8cbf130
Don't put the version for local dev-dependency
...
Otherwise we can't upload them to crate.io
2022-02-10 08:20:54 +01:00
Tobias Hunger
58e7caafb0
Fix LICENSES symlinks
2022-02-09 17:05:47 +01:00