slint-ui / slint

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

Femtovg is blurry with low DPI #2615

Closed Berrysoft closed 1 year ago

Berrysoft commented 1 year ago

Issue #1362 suggests using skia instead, but I'd like to discuss the reason of the blurry text.

https://github.com/slint-ui/slint/blob/3657c63c8ec4bfdb95821d5bd1f6f8f5d42f45d8/internal/renderers/femtovg/lib.rs#L137-L140

Here we pass DPI=1.0 to femtovg. The reason is fair that we handle the DPI ourselves. But femtovg also uses the DPI value for anti-alias.

https://github.com/femtovg/femtovg/blob/7ac3df83e92966243c6c0c648cdd989682e14072/src/lib.rs#L368-L371

I think it is necessary to pass the right DPI to make the text less blurry.

Berrysoft commented 1 year ago

The first commit to pass 1.0 as DPI: https://github.com/slint-ui/slint/commit/cd915ddbe07454e6eac7a48061351e68a6383984

Berrysoft commented 1 year ago

I've also found that the text is clearer if the passed value is larger. Maybe we can just pass a large value in...

Berrysoft commented 1 year ago

Also found blurry text on Linux with low DPI.