Commit graph

36 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
Simon Hausmann
0b028bfb6f
Add support for a font-metrics property to Text/TextInput. (#6452)
The struct held provides access to the design metrics of the font scaled
to the font pixel size used by the element.

ChangeLog: Slint Language: Added font-metrics property to `Text` and `TextInput`.

Closes #6047
2024-10-05 17:00:46 +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
a8f912900b janitor: Fix warnings in nightly about redandant use 2024-02-19 17:05:21 +01: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
J-P Nurmi
6686861523 SW: fix vertical alignment of elided multiline text 2023-10-11 14:35:20 +02:00
Aurindam Jana
5a4a7fee63
Update royalty free license to 1.1 (#2994) 2023-07-10 10:12:11 +02:00
Guilhem Vallat
555e191ab4 remove clippy::needless_borrow warnings 2023-06-30 12:28:13 +02:00
Tobias Hunger
e02c360000 Clippy polish 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
328cfc76b6 Move sharedfontdb from core to common
This way it is also accessible to the compiler.
2023-05-23 08:26:03 +02:00
Simon Hausmann
37a21ee13a Move the shared font database to core 2023-05-19 10:40:51 +02:00
Simon Hausmann
97129eb940 FemtoVG renderer: Separate the font database from the font cache
This is done in preparation for moving the database to core.
2023-05-19 10:40:51 +02:00
Florian Blasius
e25e7cf1b0 swr: implement text_input_byte_offset_for_position
* add byte_offset_for_position to TextParagraphLayout
2023-05-15 13:23:05 +00:00
Olivier Goffart
538dddf953 Update fontdb since resvg depends on the newer one 2023-03-28 15:55:27 +02:00
Simon Hausmann
6d968aa329 Extract the FemtoVG renderer into a separate crate
This will be needed for a future experiment. Unlike the Skia renderer,
which operates on raw window handles, the FemtoVG renderer exposes a
different interface where it assumes that the caller takes care of the
OpenGL context state. This means more boilerplate remains in the winit
backend, including the glutin dependency. The upside is that it will
allow using the FemtoVG renderer in environments without glutin.

In order to work in an environment without fontconfig or memmap, the
crate has two features:

  - fontconfig (set when we anticipate fontconfig to be available at
    run-time and libloading being available at compile time).
  - diskfonts (set when we want to be able to load fonts from disk)

The winit crate enables fontconfig on "Linux" and diskfonts on !wasm.
2023-03-06 11:45:28 +01:00
Olivier Goffart
35c16b9a69 Fix panics in the software renderer system font
Two bugs:
 - There was an extra `* 4` that caused panic when the Text was clipped
 - There was a bug in glyph handling when the text is being split in
   several runs
2023-01-27 12:34:45 +01: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
6dc67d5b7b janitor: work around rustybuzz version incompatibility
Use the re-export to avoid a version clash for ttf-parser.
2022-10-23 14:36:44 +02:00
Olivier Goffart
ad80e3e5e2 Fix software renderer line breaker without the unicode feature
This change makes the test pass without the unicode feature.

Note that it is not possible to run the test without the unicode feature
unless one changes the Cargo.toml, so I did that locally to run the
tests
2022-09-07 13:49:02 +02:00
Simon Hausmann
27bf9348e6 Rename the backend-gl crate into backend-winit 2022-07-26 17:43:51 +02:00
Simon Hausmann
8056836b1f Fix failing i-slint-core tests
Fix the path to the test font.
2022-07-21 14:48:49 +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
3ce142344a text handling: cleanup
Rename "byte_offset" in the Glyph structure to "text_byte_offset" to make
it clearer that this refers to the original text. Also added docs.
2022-05-16 08:21:14 +02:00
Simon Hausmann
02690bfde6 text handling: added some docs 2022-05-16 08:21:14 +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
5f52f18df4 mcu text handling: Add support for letter spacing
This is implemented generically by adjusting the advances on the shape buffer, so that we can
use the same in the future in the GL backend.
2022-05-15 12:03:29 +02:00
Simon Hausmann
a7fb45365d text handling: remove unused advance getter on TextShaper
This is available via GlyphMetrics now.
2022-05-15 11:50:54 +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
08e27fef4a text handling: move function from TextShaper to glyph trait
This will avoid the need to keep a reference to the TextShaper
around.
2022-05-15 11:50:14 +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