Commit graph

22 commits

Author SHA1 Message Date
Yuri Astrakhan
5356fdcf89 Fix clippy issues, plus a few manual cleanups
* Run `cargo clippy --fix`
*  `BackendSelector` is easier to instantiate with auto `Default`
2025-02-06 17:28:51 +01:00
Olivier Goffart
c98d234b9e Janitor: Always use `#![no_std] for runtime lib
And call `extern crate std` when the feature is enabled.
I've read this is the good practice on how to do it.
So that the std prelude is no longer included automatically.
There is then less difference between std and and no-std build which
should avoid surprises in the CI when we use things from the prelude.

The downside is that there is a bit of churn in the tests
2025-01-27 19:22:00 +01:00
Olivier Goffart
7afec3a1c5 Text layout: fix char-wrap doesn't wrap between lines
Fixes #6346

ChangeLog: Software renderer: fixed `char-wrap` not braking between lines
2024-09-27 13:29:45 +02:00
Aurindam Jana
3523e86359
Simplify commercial license (#3063)
Base the commercial license on the Royalty-free license adding clauses pertaining to the fees.
2024-05-31 14:06:17 +02:00
Aurindam Jana
9a3aa265d5
Update Royalty-free license (#5257)
Add clarification that Application may not expose Slint APIs.
2024-05-31 10:53:19 +02:00
Aurindam Jana
0cfeec1a31
Update Slint Community License (#4994)
Updated the version from 1.1 to 1.2 
Renamed the header to "Slint Royalty-free Desktop, Mobile, and Web Applications License"
Added definition of "Mobile Application" and grant of right
Moved "Limitations" to 3rd section and "License Conditions - Attributions" to 2nd section
Added flexibility to choose between showing "MadeWithSlint" as a dialog/splash screen or on a public webpage
Moved the para on copyright notices to section under "Limitations"
2024-04-15 15:18:55 +02:00
Tobias Hunger
b12575a4c4 janitor: Go over our spell checking setup
* Extend the cspell word list
* Remove those extensions from individual source files
* white-list licenses and such as we should not meddle with those
* Fix spelling
2023-10-16 09:01:51 +02:00
Aurindam Jana
5a4a7fee63
Update royalty free license to 1.1 (#2994) 2023-07-10 10:12:11 +02:00
Tobias Hunger
e81a3d40f0 Get rid of more clippy warnings
* Configure clippy to not report about type complexity until *much*
  later
* Configure clippy to only complain about more than 10 function
  arguments
* Properly format safety sections
* Allow unnecessary main functions in doctests in the slint API crate
* AccessKit: Move big block of code before if condition
2023-06-28 14:22:30 +02:00
Olivier Goffart
11dea135f7 Domain: slint-ui.com -> slint.dev 2023-06-16 10:55:08 +02:00
Aurindam Jana
039e54a5de
Add royalty free license to files except examples and docs (#2888) 2023-06-15 11:20:50 +02:00
Simon Hausmann
8ffd17007a textlayout: Fix cursor position calculation when clicking at the end of lines with forced line break
Make sure that the byte ranges of adjancent fragments have no gaps.

Co-authored-by: Florian Blasius <FloVanGH@users.noreply.github.com>
2023-05-17 09:58:45 +02:00
Simon Hausmann
aec8a86c02 textlayout: Fix missing byte range on empty lines
Even for an empty line, we should report a byte range so that clicking into an empty line
can produce a cursor offset.

The previous behavior was covered by an existing test, that's now adjusted.
In addition a new test covers that we report the correct
start also for lines starting with whitespace (non-breaking, that is - regular
breaking whitespace is covered by the line breaker).
2023-05-15 17:15:53 +02:00
Simon Hausmann
6ad30c9bd4 Fix cursor_pos_for_byte_offset to return the correct x coordinate when the cursor is within the trailing whitespace of a line
Co-authored-by: Florian Blasius <FloVanGH@users.noreply.github.com>
2023-05-11 10:34:49 +00:00
Simon Hausmann
d69b4b81ba Simplify glyph handling in the software renderer
Remove platform glyph abstraction, just use non-zero u16 as glyph index
like everyone else.  As a bonus, this reduces the memory consumption of
the glyph buffers per glyph from a size of a pointer to the size of the
u16.
2022-12-16 18:20:12 +01:00
Simon Hausmann
90ba9ffa17 Fix "glyph box" in AboutSlint when rendered on MCU
The AboutSlint text has a forced linebreak in it, which becomes a box
glyph on MCUs when the font on the host system doesn't use an empty
glyph but a box glyph for \n.

This patch explicitly excludes glyph clusters from text fragments that
feed into lines that originate from one of the three valid separators:
ascii newline, unicode paragraph and unicode line separators.
2022-09-05 21:42:26 +02:00
Simon Hausmann
38abeaec41 text handling: clean up font traits
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.
2022-05-16 08:21:14 +02:00
Simon Hausmann
b6eba63f8e text handling: fix glyph cluster type names
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.
2022-05-15 12:03:29 +02:00
Simon Hausmann
93b5eda82e text handling: simplify glyph data structure handling
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.
2022-05-15 12:03:29 +02:00
Simon Hausmann
99ea6db9d4 text handling: simplify shaper <> glyph relation
Use the Glyph trait also for the byte offset handling, to avoid the use of
tuples.
2022-05-15 12:03:29 +02:00
Simon Hausmann
ba59bd5e52 text handling: simplify grapheme and text fragment iterators
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.
2022-05-15 11:50:37 +02:00
Simon Hausmann
a9cbac6d3e New line breaking implementation
This is a simpler design that handles various line breaking scenarios
(see added tests) much better.
2022-05-14 15:04:24 +02:00