webview_rust
webview_rust copied to clipboard
Fractional / HIDPI support (Windows)
Follow-up of https://github.com/webview/webview/issues/54
In short, on Windows 10 (maybe 8 and 7, can't check), there is an option to use fractional resolutions for the interface (and all application), meaning that you can pick 100%, 125%, 150% 175%, 200% and so on.
The thing is, fractional pixels doesn't exists, where 100% and 200% are simple to implement since you just have to double the pixel's size (2x2 instead of 1x1), in-between values are more tricky.
Windows seems to rely on two different tricks to support those :
- Displaying properly "fractional" pixels using (unknown to me) wizardry .
- A fallback that render the software at a "normal" scaling (100%) and then upscale the output to the desired scaling (125%) resulting in blurry renders.
Tauri, per default, is using the 2nd trick, resulting in blurry applications :
Screenshot of the issue, with a top window which is Firefox displaying the application properly, and the bottom window a Tauri app being blurred
Steps to reproduce this behaviour:
- In the Windows 10's system settings, set the scaling to a fractional one.
- Start a Tauri project
- Build / Run dev
- See the blurriness
Thankfully, thanks to @Ciantic works, it seems to be pretty trivial to fix this issue, here is the solution provided by them : https://github.com/webview/webview/issues/54#issuecomment-667666668