High DPI and version 3.1.2 Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
refaelsh
Earned a small fee
Earned a small fee
Posts: 20
Joined: Tue Feb 05, 2019 7:25 pm

High DPI and version 3.1.2

Post by refaelsh » Thu Feb 07, 2019 6:39 pm

Hello.
I want to use the `Consolas` font in my app, but in Clear Type. I tried doing it like this:

Code: Select all

const wxFont font(wxFontInfo(13).AntiAliased(false).FaceName("Consolas"));
frame->m_richText->SetFont(font);
But it came out all `smudged`, I don't really know how to describe it, so here is a picture:
https://www.dropbox.com/s/w2wkpnry3iowx ... s.png?dl=0

Then I tried changing this setting in Visual Studio to `High DPI Aware`:
https://www.dropbox.com/s/03u9ecxuzavo9 ... g.png?dl=0
And it looks to me the same as before, but here is a picture just in case:
https://www.dropbox.com/s/jwes1rigoaqls ... e.png?dl=0

Then I tried changing the setting to be `Per Monitor High DPI Aware` and here how it looks:
https://www.dropbox.com/s/qcvdtcit0wejx ... e.png?dl=0
Do you notice that everything became... ah... kinda smaller? The title bar is thiner for example, the text size in the button became smaller, in fact all the text became smaller, oh and, it makes my head heart when I look at the app with this setting. But now the font look gorgeous, nice and crispy, True Type.

What I need is for my head not to heart :-) and for the fonts to stay the same size and the title bar to be its normal thickness (and all the other widgets should preserve their size too) but I want the gorgeous crispy Clear Type font.

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

Re: High DPI and version 3.1.2

Post by doublemax » Thu Feb 07, 2019 7:03 pm

1) Using ClearType and HighDPI are two totally unrelated topics

2) wxFontInfo::AntiAliased() is currently not implemented on any platform and does nothing (as stated in its documentation)

3) You should mark your exe as "dpi aware", but not "per monitor dpi", as the latter is not supported by wxWidgets yet. It would require to reinitialize all controls when you move the app from one monitor to another with a different pixel density

4) There is a method to enable ClearType under Windows using wxFont::Get/Set NativeFontInfoDesc()
viewtopic.php?f=23&t=21733

5) But AFAIK ClearType is not enabled at small font sizes
Use the source, Luke!

refaelsh
Earned a small fee
Earned a small fee
Posts: 20
Joined: Tue Feb 05, 2019 7:25 pm

Re: High DPI and version 3.1.2

Post by refaelsh » Thu Feb 07, 2019 7:27 pm

doublemax wrote: 1) Using ClearType and HighDPI are two totally unrelated topics
Understood.

doublemax wrote: 2) wxFontInfo::AntiAliased() is currently not implemented on any platform and does nothing (as stated in its documentation)
Understood.

doublemax wrote: 3) You should mark your exe as "dpi aware", but not "per monitor dpi", as the latter is not supported by wxWidgets yet. It would require to reinitialize all controls when you move the app from one monitor to another with a different pixel density
Understood.

doublemax wrote: 4) There is a method to enable ClearType under Windows using wxFont::Get/Set NativeFontInfoDesc()
viewtopic.php?f=23&t=21733
This solves it! Thank you very much!

doublemax wrote: 5) But AFAIK ClearType is not enabled at small font sizes
Understood.

Post Reply