Search code examples
c++wxwidgetswebview2

How to disable DPI scaling in wxWebview in wxWidgets?


I am working with the wxWebView of wxWidgets 3.2.1 in Windows 10. I am also using the Edge backend (WebView2). I have a problem in High DPI monitors and that's the automatic scaling of the Edge. I don't want this automatic scaling and prefer to set the font size manually with the use of some helpful functions like FromDIP. Apparently setting font does not work in this case.

I have seen a way to disable this feature in Chrome by command options like below (Ref) but don't know how to do this in wxWidgets.

--high-dpi-support=1 --force-device-scale-factor=1

Update: In the source of the page, I have a style tag and font is set there and I have the ability to change this font on DPI change event. Currently I don't change the font on the event.


Solution

  • It seems that there is not any way to disable scaling feature in Edge via wxWidgets. Therefore because of this automatic upscaling in Edge, I had to downscale my font size first with the use of GetDPIScaleFactor().