slint-ui / slint

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

Glyph rendering differs between Skia, FemtoVG, and Slint Software Renderer #3742

Open qarmin opened 8 months ago

qarmin commented 8 months ago

1.3.0 - 49571c8bf2aaac499aaa678829651384fc93fdc9

This may be caused by anti aliasing method, but still I think that this should be unified between renderers.

Screenshot from 2023-10-23 18-39-57 Screenshot from 2023-10-23 18-40-13 Screenshot from 2023-10-23 18-40-26

Screenshot from 2023-10-23 19-09-22 Screenshot from 2023-10-23 19-10-14

tronical commented 8 months ago

From the screenshots I'm assuming that this is Linux.

(1) Skia is using the system libraries for rasterising glyphs, which means it's using freetype. That is the one and true correct choice, as everything else in the system is / should be using it.

(2) The software renderer is using fontdue to rasterise the glyphs. We could change this to use free type, but since there's no way of "detecting" availability at run-time, it would mean that free type builds either a build-time requirement for std builds, or it would be an opt-in feature in the public crates.

(3) FemtoVG is using its own path-antialiasing algorithm to rasterising glyphs. It would be desirable to change that to use externally rasterised glyphs (and I have a patch set that adds API to allow for that), but similar to the software renderer we'd have to make a choice here what rasteriser to use.

Another option would be to unify (2) and (3) to use swash, which appears to produce high quality glyphs.

Tagging this as RFC because this issue could benefit from wider input.

rice7th commented 3 months ago

Swash would definitely be a nice option