slint
slint copied to clipboard
Font conguration for embedded fonts for the software renderer on MCU
When compiling with slint_build::EmbedResourcesKind::EmbedForSoftwareRenderer
, we need a way to specify with font to embed, which glyph ranges, which sizes.
Currently there is some code that tries to auto-detect the sizes, and there is also the undocumented SLINT_FONT_SIZES
env variable.
But embedding all the fonts with all the glyphs with all size variant is taking way too much flash and is not practical.
Some options: (We can combine several approach)
- Have a config file somewhere (see https://github.com/slint-ui/slint/issues/267 )
- Some more configuration in slint_build
- Add some syntax to the
import "foo.ttf";
statement so we can specify sizes and ranges - Improve the flexibility of environment variables, and document them.
Would it be possible to extend Platform or add another Trait with a call like get_glyph(...) -> Option<...>
?
If a glyph is not found in the embedded font data, slint asks for the glyph.
There is another issue for loading font at runtime: https://github.com/slint-ui/slint/issues/4250 But a fallback in the platform seems like a good idea as well.