Font bold and blur in wxWidgets3.1 under Windows10

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Anil8753
Experienced Solver
Experienced Solver
Posts: 73
Joined: Sat Jan 16, 2016 5:57 am

Font bold and blur in wxWidgets3.1 under Windows10

Postby Anil8753 » Mon Aug 06, 2018 9:29 am

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
};
Attachments
font issue with wx3.1.png
Last edited by Anil8753 on Fri Aug 10, 2018 4:35 pm, edited 1 time in total.

User avatar
doublemax
Moderator
Moderator
Posts: 12511
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

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

Postby doublemax » Mon Aug 06, 2018 11:01 am

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/
Use the source, Luke!

Anil8753
Experienced Solver
Experienced Solver
Posts: 73
Joined: Sat Jan 16, 2016 5:57 am

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

Postby Anil8753 » Tue Aug 07, 2018 7:25 am

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.
Last edited by Anil8753 on Fri Aug 10, 2018 6:57 am, edited 1 time in total.

Anil8753
Experienced Solver
Experienced Solver
Posts: 73
Joined: Sat Jan 16, 2016 5:57 am

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

Postby Anil8753 » Fri Aug 10, 2018 6:55 am

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.

User avatar
doublemax
Moderator
Moderator
Posts: 12511
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

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

Postby doublemax » Fri Aug 10, 2018 8:22 am

After keeping the High DPI Aware option in the manifest file all the wxWidget3.1 changes for high dpi are not working.
What happened?
Use the source, Luke!

PB
Part Of The Furniture
Part Of The Furniture
Posts: 1627
Joined: Sun Jan 03, 2010 5:45 pm

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

Postby PB » Fri Aug 10, 2018 8:50 am

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.

Anil8753
Experienced Solver
Experienced Solver
Posts: 73
Joined: Sat Jan 16, 2016 5:57 am

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

Postby Anil8753 » Fri Aug 10, 2018 8:52 am

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

User avatar
doublemax
Moderator
Moderator
Posts: 12511
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

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

Postby doublemax » Fri Aug 10, 2018 2:33 pm

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.
Use the source, Luke!

Anil8753
Experienced Solver
Experienced Solver
Posts: 73
Joined: Sat Jan 16, 2016 5:57 am

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

Postby Anil8753 » Fri Aug 10, 2018 4:16 pm

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.

User avatar
doublemax
Moderator
Moderator
Posts: 12511
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

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

Postby doublemax » Fri Aug 10, 2018 4:50 pm

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
Use the source, Luke!


Return to “Platform Related Issues”

Who is online

Users browsing this forum: No registered users and 8 guests