-1

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.

Reza
  • 3,473
  • 4
  • 35
  • 54
  • what's wrong with automatic scaling? – Igor Nov 03 '22 at 12:58
  • @Igor I set the font scale in a CSS file. The automatic scaling scale that font for me which is wrong and it is bigger. If I want to use the automatic scale, I have to change that hard-coded font size in CSS by the DPI factor and then automatic scaling works! – Reza Nov 03 '22 at 14:22
  • what CSS file you are talking about? Is it some kind of HTML/XML file you are using for the page? Or its something you set the parameters of the browser? If its the latter and you have control over it - why do you need the calculation yourself? – Igor Nov 03 '22 at 16:04
  • If that file is in use because you are using IE and Edge backends - drop it. IE is going away really soon and it will not be supported by MS anymore. I suggest to get rid of all hacks yuo did to support both and leave only the Edge support. – Igor Nov 03 '22 at 16:06
  • @Igor I have updated the question. I don't use IE backend – Reza Nov 03 '22 at 17:23
  • do you have control over the page source? If not - can you contact the author of the page? My point is - if the automatic scaling works - why not use it. It's possible the code for page was done a long time ago and is irrelevant now when HighDPI is everywhere. – Igor Nov 03 '22 at 17:45

1 Answers1

1

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().

Reza
  • 3,473
  • 4
  • 35
  • 54