Commit graph

20 commits

Author SHA1 Message Date
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
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
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
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
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
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
Renamed from internal/core/swrenderer/fonts.rs (Browse further)