Turning off text antialiasing?

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
Laurent22300
Knows some wx things
Knows some wx things
Posts: 30
Joined: Sun Sep 07, 2008 9:38 am
Contact:

Turning off text antialiasing?

Post by Laurent22300 » Sun May 17, 2009 5:52 pm

Hi,

Is it possible to turn off anti-aliasing when using wxDC::DrawText? I've tried setting the antialiasing off when creating the font but it doesn't seem to work, or maybe I'm not doing it right. Here is the code I'm using:

Code: Select all

wxFont* font = wxFont::New(10, wxFONTFAMILY_DEFAULT, wxFONTFLAG_NOT_ANTIALIASED, wxEmptyString, wxFONTENCODING_DEFAULT);

dc.SetFont(*font);
dc.SetTextForeground(wxColor(0,0,0));
dc.DrawText(_T("test"), 0, 0); // Doesn't work - the text is still antialiased
Can anybody see what the issue is?

Thanks,

Laurent
Appetizer - the wxWidgets dock for Windows.

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

Post by doublemax » Sun May 17, 2009 6:27 pm

wxFONTFLAG_NOT_ANTIALIASED is not supported. The flag is not used anywhere in the wx sources.
Use the source, Luke!

Laurent22300
Knows some wx things
Knows some wx things
Posts: 30
Joined: Sun Sep 07, 2008 9:38 am
Contact:

Post by Laurent22300 » Sun May 17, 2009 7:05 pm

Do you know if there's any alternative to draw non-antialised text?
Appetizer - the wxWidgets dock for Windows.

ninja9578
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 236
Joined: Thu Jan 29, 2009 3:33 pm

Post by ninja9578 » Sun May 17, 2009 7:18 pm

That's an across OS function, I don't think it's possible for any API to shut it off for one program. You can turn it off in your System Preferences, Its called truetype fonts on OSX, not sure about Windows.

palacs
Knows some wx things
Knows some wx things
Posts: 45
Joined: Mon May 30, 2016 11:11 am

Re: Turning off text antialiasing?

Post by palacs » Mon Mar 06, 2017 2:19 pm

I would also be interested in turning off anti-aliasing under Windows while ClearType is enabled system-wide.
ninja9578 wrote:That's an across OS function, I don't think it's possible for any API to shut it off for one program.
It is. Take a look at Font.Quality set to fqNonAntialiased in Lazarus. It works under my Windows 10 box with ClearType enabled.

wxWidgets should have the same somewhere. At least I hope so.

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

Re: Turning off text antialiasing?

Post by doublemax » Mon Mar 06, 2017 5:05 pm

Not in the public API.

But under Windows it can be done:
viewtopic.php?p=162626#p162626
Use the source, Luke!

palacs
Knows some wx things
Knows some wx things
Posts: 45
Joined: Mon May 30, 2016 11:11 am

Re: Turning off text antialiasing?

Post by palacs » Mon Mar 06, 2017 6:03 pm

So that would probably mean an #ifdef but is possible. Good news. Thanks.

New Pagodi
Super wx Problem Solver
Super wx Problem Solver
Posts: 361
Joined: Tue Jun 20, 2006 6:47 pm
Contact:

Re: Turning off text antialiasing?

Post by New Pagodi » Mon Mar 06, 2017 9:30 pm

palacs wrote:So that would probably mean an #ifdef but is possible. Good news. Thanks.
There's also the wxGetOsDescription() function. You might be able to use that instead.

Post Reply