slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
17.73k stars 614 forks source link

slint font rendering is very poor, how to solve it #6365

Closed xiacc-cn closed 15 hours ago

xiacc-cn commented 2 months ago

See the picture below image

ogoffart commented 2 months ago

Do you know what renderer/backend you are using? There are some differences between skia and femtovg. I think skia is used in the live preview, while femtovg is the default in a rust application unless you enable skia with a feature flag.

nproux commented 2 months ago

Not OP, but I ran into the same issue and changing to the skia renderer seems to resolve it for me. The font rasterization in the default renderer and default text family (for Windows 11 environment at least) seems to be impressively bad right now. For reproduction I was using English characters at font sizes 20px and 24px, both bold and regular, with a Rust backend. Build and run in release mode and you should notice it right away.

It might be a bug in the renderer rather than Slint itself, but I suggest that what Slint picks as the default renderer should probably be biased towards something that visually looks decent. New users aren't likely to dig into details of how to make things better if their initial testing has pretty poor results. That said your team might have other concerns I'm not aware of that make the current default choice the better tradeoff, so feel free to ignore me on that.

mackrol commented 1 month ago

Any progress on the font quality? Text layout and font rendering in the examples is extremely poor. Tested on Win10 1920x1200 100% text scaling

  1. uneven horizontal spacing between glyphs (see "consetetur"):

image

or even worse

image

  1. incomplete glyphs (see "Item 1.3")

image

  1. broken vertical placement of glyphs (see "0 Moves 15 Tiles left" message)

image

hunger commented 3 weeks ago

@mackrol: Did you try the skia renderer? It tends to render a bit nicer for me, but unfortunately is more error-prone to build, too :-/

tronical commented 15 hours ago

This is a known issue, the quality of the built-in femtovg glyph rasterization using its own path renderer has seen frequent complaints. AFAICS everyone in the Rust ecosystem is using swash nowadays (bevy via cosmic-text, vello, etc.), and I'd like to move femtovg over to that, as well.

tronical commented 15 hours ago

Duplicate of #3742