Replies: 2 comments
-
Right now bitmap fonts are unfortunately not supported out of the box. That's ironic because the glyphs pre-rendered at compile-time are bitmaps (well, alpha-maps :-). But I agree, we should support them. If it's okay with you, I'll convert this discussion into an issue, because this is something that should be implemented in Slint. I see different ways of doing this:
I'm unsure about pcf - that would probably require writing a PCF parser. Or does anyone know of a crate out there that supports it? @oskude How would you feel about converting your PCF font to a TrueType font with embedded bitmaps? Do you know if there are any good tools? (I'm asking because that could also be documented in Slint) |
Beta Was this translation helpful? Give feedback.
-
I'm fine with converting to TrueType bitmap font. And especially as Slint already uses TTF, sounds like the best choice! For font tools i've only used https://fontforge.org To test i opened a PCF font from https://terminus-font.sourceforge.net/ and created a TTF from it with:
And this Slint code compiles: import "./TerminusMedium.ttf";
export component MainWindow inherits Window {
default-font-family: "Terminus";
default-font-size: 12px;
... There is no text shown in app, i assume as expected, cause the TTF has only bitmap fonts. But otherwise everything else is shown and works, cool! If useful, here's the TTF file it generated: PS. I'm a font (and rust and embedded) newbie, but i'm happy to test or help anything 😅 |
Beta Was this translation helpful? Give feedback.
-
can we use bitmap fonts in (embedded rust) slint?
or other way to get crisp fonts on smaller sizes?
ps. fwiw, i was able to use pcf fonts with micropython, nanogui and https://github.com/peterhinch/micropython-font-to-py - but now i found slint and can't go back ❤️
Beta Was this translation helpful? Give feedback.
All reactions