Page 1 of 1

Font bold and blur in wxWidgets3.1 under Windows10

Posted: Mon Aug 06, 2018 9:29 am
by Anil8753
I updated the wxWidgets from 3.0 to 3.1, I see with wx3.1 application font became bold and blur (please refer the attachment).
I am using

Code: Select all

wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)
to get the fonts.

And using wxFontSymbolicSize for different size of fonts.

Code: Select all

enum wxFontSymbolicSize
{
    wxFONTSIZE_XX_SMALL = -3,
    wxFONTSIZE_X_SMALL,
    wxFONTSIZE_SMALL,
    wxFONTSIZE_MEDIUM,
    wxFONTSIZE_LARGE,
    wxFONTSIZE_X_LARGE,
    wxFONTSIZE_XX_LARGE
};

Re: Font bold and blur in wxWidgets3.1 under Windows10

Posted: Mon Aug 06, 2018 11:01 am
by doublemax
This looks like it's a problem with DPI awareness. Does the screen have a font scaling > 100% ?

Try marking your application as "DPI aware" through the manifest:
https://blogs.msdn.microsoft.com/chuckw ... t-madness/

Re: Font bold and blur in wxWidgets3.1 under Windows10

Posted: Tue Aug 07, 2018 7:25 am
by Anil8753
Thank you very much. It helped me to address the issue. (only on a system where zoom level is125% and the resolution is1920x1080. It is not a hight DPI system.

Re: Font bold and blur in wxWidgets3.1 under Windows10

Posted: Fri Aug 10, 2018 6:55 am
by Anil8753
My bad, it created the bigger problem and I have to revert the High DPI Aware option.
After keeping the High DPI Aware option in the manifest file all the wxWidget3.1 changes for high dpi are not working.

I tried the High DPI Aware option on the surface where zoom level is 200% and resolution is 3000x2000.

Re: Font bold and blur in wxWidgets3.1 under Windows10

Posted: Fri Aug 10, 2018 8:22 am
by doublemax
After keeping the High DPI Aware option in the manifest file all the wxWidget3.1 changes for high dpi are not working.
What happened?

Re: Font bold and blur in wxWidgets3.1 under Windows10

Posted: Fri Aug 10, 2018 8:50 am
by PB
Anil8753 wrote:Thank you very much. It helped me to address the issue. (only on a system where zoom level is125% and the resolution is1920x1080. It is not a hight DPI system.
Actually, a system where you set UI scaling to 125% is a high-DPI system, having DPI of 120 compared to standard 96.

Re: Font bold and blur in wxWidgets3.1 under Windows10

Posted: Fri Aug 10, 2018 8:52 am
by Anil8753
After enabling "High DPI Aware" on High DPI Surface Pro (zoom 200%), UI became unusable as It was unusable with wx3.0 (wx3.0 was not having high DPI support).
With wx3.1, application layout works fine but it is coming blur, to solve the blur issue I did the manifest changes to make my application DPI-aware, it removed the blur effect but application layout went wrong, every layout looks smaller (unusable UI).

Interestingly, on another non-high dpi system where zoom level was 125%, was also facing the blur issue. But manifest file change mentioned by you solved the issue.

Note* issue more vigilant on 3K and 4K system. Hardcoded pixel sizes are not scaling (like 400px width button, 500pixel width panel etc).

Re: Font bold and blur in wxWidgets3.1 under Windows10

Posted: Fri Aug 10, 2018 2:33 pm
by doublemax
Hardcoded pixel sizes are not scaling (like 400px width button, 500pixel width panel etc).
That's to be expected. Hardcoded values are always obeyed. That's why you should avoid them wherever possible.

Re: Font bold and blur in wxWidgets3.1 under Windows10

Posted: Fri Aug 10, 2018 4:16 pm
by Anil8753
That will not be possible. Many times we use hardcoded pixels for margin/padding. We have images 16x16 or 24x24 given by UX team, so automatic scaling is needed.
Even many places we can see hardcoded pixel values especially in the case of generic implementation.
Mac retina (4k) everything works fine where hard-coded pixels are scaled. Ideally SetSize(), SetMaxSize(), SetMinSize() should automatically take care of scaling.

I am not able to understand if I do not set the High DPI aware true, everything (hard-coded pixels/bitmap size) works fine, I do not see any UI distortion. only thing is they are blur.

Re: Font bold and blur in wxWidgets3.1 under Windows10

Posted: Fri Aug 10, 2018 4:50 pm
by doublemax
I am not able to understand if I do not set the High DPI aware true, everything (hard-coded pixels/bitmap size) works fine, I do not see any UI distortion. only thing is they are blur.
That's because Windows will run your program in an "emulation" mode, it will render into an un-scaled offscreen buffer at 100%, then Windows itself will scale it up. That's why everything gets blurry.

In order to keep the hardcoded values, you need to replace all occurrences with a call to wxWindow::ToDIP().
http://docs.wxwidgets.org/trunk/classwx ... 257e09d123