Olivier Goffart
da83857a60
Remove embedded_graphics dependency from i-slint-core
...
This feature was never used.
2023-06-22 14:12:01 +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
6b8214c3f9
Add support for italic and bold text in the software renderer's bitmap font path
...
In the screenshot tests this works by setting SLINT_DEFAULT_FONT to
pointer to a directory, instead of a file. We then load all fonts in
that directory and consider their families the default unless a family
is specified. This way for "Noto Sans" a regular as well as an italic
version is registered in fontdb and returned in the list of font
fallback ids. embed_glyphs in the compiler then embeds those variants
and we find them at run-time.
2023-05-31 18:47:39 +02:00
Simon Hausmann
057493b3a9
Add support for italic text in the software renderer's vector font path
...
Centralize also fontdb::Query creation and family fallback handling in
sharedfontdb. This way SLINT_DEFAULT_FONT also works for the femtovg
renderer.
2023-05-31 18:47:39 +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
0c11408dc5
Cleanup in software renderer systemfonts implementation
...
Make the VectorFont struct lighter by not having a reference to the
fontdb, which is thread-local anyway.
2023-05-19 10:40:51 +02:00
Simon Hausmann
51dc58a70a
Use the shared fontdb for the software renderer's systemfonts feature
2023-05-19 10:40:51 +02:00
Olivier Goffart
98747cd385
Winit software renderer: Fix transparent background
...
Despite the documentation of softbuffer claiming that the high bits
should be 0, it seems to be interpreted as an alpha value when the
window is actually transparent.
And the values are considered as premultiplied alpha
Also use a Premultiplied aplha for the buffer so we can even have
transparent window with the software renderer
2023-05-03 19:29:51 +02:00
Simon Hausmann
0e89ae220a
janitor: bump fontdb
2023-04-24 09:28:09 +02:00
Florian Blasius
f0ca191231
load system fonts for redox ( #2597 )
2023-04-20 08:43:17 +02:00
Olivier Goffart
538dddf953
Update fontdb since resvg depends on the newer one
2023-03-28 15:55:27 +02:00
Simon Hausmann
b38df20d9a
Add a feature to enable system fonts with the software renderer
...
If we have a file system, then we can allow users of the software
renderer to support text rendering by from fonts served by the file
system.
cc #2100
2023-03-28 11:33:44 +02:00
Tobias Hunger
3ac01c3f07
clippy: Fix clippy warnings
2023-03-09 09:35:29 +01:00
Simon Hausmann
c10349b2d1
Fix software renderer system fonts on some Yocto distros
...
Add "Liberation Sans" as another default system font we could look for.
2023-03-06 13:55:53 +01:00
Simon Hausmann
860f318f7c
Bump femtovg, rustybuzz, ttf-parser, and fontdb dependencies ( #2191 )
...
Mostly bugfix changes upstream with some minor API changes. FemtoVG is
no more limited to 24 gradient stops for the paint.
2023-02-08 09:56:53 +01:00
Olivier Goffart
995d960a2a
Comile with Rust < 1.66
...
wrapping_add_signed was added in Rust 1.66
2023-02-02 15:54:07 +01:00
Olivier Goffart
a4eb1ab287
swrenderer support for linear gradient
...
Only simple rectangle (no borders or radius)
2023-02-02 15:54:07 +01:00
Simon Hausmann
143a1881f1
software renderer: prefer bitmap fonts over vector fonts
...
Change the font selection in the software renderer to always prefer
embedded bitmap fonts. This way when running `cargo test -p
test-driver-screenshots` the pixel fonts are used (as before this patch)
as well as in the CI, when all features are enabled (including
"systemfonts").
This originates from #2141
2023-01-30 11:38:41 +01:00
Simon Hausmann
a3aaa5f9c8
Add support for SLINT_FONT_FALLBACK to the systemfonts approach of the software text renderer
2023-01-09 14:12:33 +01:00
Olivier Goffart
b620986e35
Fix 16bit blending
...
The comments were a bit off, and we were loosing one bit in the blue LSB
Reported in https://github.com/slint-ui/slint/pull/1576#pullrequestreview-1232577955
2023-01-05 12:08:21 +01:00
Simon Hausmann
a440894588
Prospective fix for loading fonts with the software renderer from the system on Linux
...
Try a few fallback families that usually exist, instead of querying fontconfig from corelib.
2022-12-16 18:20:12 +01:00
Simon Hausmann
bf8187fed1
Cache glyphs rendered from truetype fonts
...
and cache the fontdue::Font as well, since that's also slow to create.
2022-12-16 18:20:12 +01:00
Simon Hausmann
2b7d4e7793
Basic implementation of the last resort font fallback for fontdb
2022-12-16 18:20:12 +01:00
Simon Hausmann
d92c49e09c
Separate pixel and vector fonts into modules of their own
2022-12-16 18:20:12 +01:00
Simon Hausmann
dee1b11a83
Initial support for truetype fonts in the software renderer
...
This works, but it's super slow as for every glyph the font is loaded
again and the glyphs are rasterized every time they're drawn.
2022-12-16 18:20:12 +01:00
Simon Hausmann
7cf312667e
Remove internal duplicated FontMetrics trait
...
There's also one in the textlayout module and this was is just confusing as a trait.
2022-12-16 18:20:12 +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
Olivier Goffart
830e33876f
swrenderer: Fix drawing of images
...
There was some confusin on the meaning of the alpha and colorize and how
it is computed for AlphaMap images
2022-11-30 16:49:23 +01:00
Florian Blasius
00bd4909e1
SoftwareRenderer: render texture with opacity and color alpha channel ( #1877 )
...
* swr: add alpha field to texture
2022-11-21 15:26:35 +01:00
Simon Hausmann
39121994ca
Always set Window.default-font-size
...
Permit the style metrics to provide a `default-font-size` and bind that
to the `Window` if set. If not provided, then the backend can set a
`default-font-size`. By ensuring that the value is non-zero at run-time,
we can later introduce a rem unit that can act as factor relative to
this non-zero font size.
2022-11-03 17:15:44 +01:00
Simon Hausmann
37a8c50c12
Simplify FontRequest
...
It doesn't have to be generic as mostly the frontend code creates it with logical lengths.
2022-09-30 23:31:32 +02:00
Simon Hausmann
a52d633b59
Change FontRequest to be a generic over the length
...
The API uses a logical length for pixel sizes and letter spacing,
but the renderer will need the physical length eventually.
2022-09-30 13:00:37 +02:00
Simon Hausmann
1624a66ebc
Change the Renderer trait's text related functions to explicitly operate on logical lengths
2022-09-30 13:00:37 +02:00
Simon Hausmann
d698af5326
Move physical length definitions into the software renderer
...
Their choice of i16 is specific to the software renderer. In say the Skia renderer
the physical coordinate space would still use Skia's Scalar (floating points).
2022-09-30 09:03:02 +02:00
Olivier Goffart
36845dcbab
Support drawing embedded textures with the non-software renderers
2022-09-07 18:44:14 +02:00
Olivier Goffart
1ba4450115
Apply suggestions from code review
...
Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
2022-09-07 17:11:57 +02:00
Olivier Goffart
abbf1edd91
Better error message when using the software renderer with a .slint file not compiled for it
2022-09-07 17:11:57 +02:00
Tobias Hunger
639dcaf702
api: Rename module swrenderer
to software_renderer
...
Also rename the `swrenderer` feature to `software-renderer`.
2022-09-07 10:11:11 +02:00