wxWidgets & ClearType Topic is solved

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.
Post Reply
givemeaname
In need of some credit
In need of some credit
Posts: 9
Joined: Wed Jun 11, 2008 9:35 am

wxWidgets & ClearType

Post by givemeaname » Wed Nov 12, 2008 5:15 pm

Hello,

does someone know how i can disable the cleartype-effect for a MSW-wxWidgets program? i need to draw some fonts without the cleartype-effect.

i know that cleartype can be globally turned on/off in windows, but thats not an option.

does someone knows a solution for that problem?

thanks for your help!

frank_frl
Earned some good credits
Earned some good credits
Posts: 139
Joined: Sat Feb 18, 2006 1:41 pm
Location: Germany

Post by frank_frl » Thu Nov 13, 2008 7:58 am

There is a flag for wxFont, but I don't know if that works on MSW.

Code: Select all

enum
{
    // no special flags: font with default weight/slant/anti-aliasing
    wxFONTFLAG_DEFAULT          = 0,

    // slant flags (default: no slant)
    wxFONTFLAG_ITALIC           = 1 << 0,
    wxFONTFLAG_SLANT            = 1 << 1,

    // weight flags (default: medium)
    wxFONTFLAG_LIGHT            = 1 << 2,
    wxFONTFLAG_BOLD             = 1 << 3,

    // anti-aliasing flag: force on or off (default: the current system default)
    wxFONTFLAG_ANTIALIASED      = 1 << 4,
    wxFONTFLAG_NOT_ANTIALIASED  = 1 << 5,

    // underlined/strikethrough flags (default: no lines)
    wxFONTFLAG_UNDERLINED       = 1 << 6,
    wxFONTFLAG_STRIKETHROUGH    = 1 << 7,
};
WinXp SP3, OS X10.5.5; CodeLite, Dialog::Blocks, wxWidgets 2.8.10

givemeaname
In need of some credit
In need of some credit
Posts: 9
Joined: Wed Jun 11, 2008 9:35 am

Post by givemeaname » Thu Nov 13, 2008 4:47 pm

Thanks for your answer. I tried the flags but they dont seem to work.
I also found this function:

Code: Select all

wxFont::SetNoAntiAliasing(bool);
But it doesn't work neither.


Ive found another solution that might be helpful for others:
i develop a tool that draws text and graphics on a monochrome LC-Display. so i changed the depth of wxBitmap/wxMemoryDC to 1.
Now fonts are drawn without the aliasing effect.

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

Post by doublemax » Thu Nov 13, 2008 9:01 pm

a few comments:
a) antialiasing fonts and cleartype are two different things

b) the wxFONTFLAG_ANTIALIASED etc. flags are dummies, they are not used anywhere in the wxWidgets sources

c) the desired effect can be achieved by manually changing the native font info (wxFont::GetNativeFontInfoDesc()) and setting it back (wxFont::SetNativeFontInfo()). If anyone is interested in details, ask again. Too lazy to explain now ;)
Use the source, Luke!

givemeaname
In need of some credit
In need of some credit
Posts: 9
Joined: Wed Jun 11, 2008 9:35 am

Post by givemeaname » Fri Nov 14, 2008 1:59 pm

Thanks for pointing that out. I will give it a try.

marksatterfield
Knows some wx things
Knows some wx things
Posts: 33
Joined: Fri Jun 30, 2017 12:34 pm

Re: wxWidgets & ClearType

Post by marksatterfield » Fri Oct 26, 2018 4:26 pm

Did anyone actually post the explanation on how to do this?

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

Re: wxWidgets & ClearType

Post by doublemax » Fri Oct 26, 2018 4:56 pm

The string you get from GetNativeFontInfoDesc() looks like this:

Code: Select all

"0;-24;0;0;0;400;0;0;0;1;0;0;3;32;Lucida Sans Unicode"
The 13th value, in this case "3" is the FontQuality.

Possible values are:

Code: Select all

 typedef  enum
 {
   DEFAULT_QUALITY = 0x00,
   DRAFT_QUALITY = 0x01,
   PROOF_QUALITY = 0x02,
   NONANTIALIASED_QUALITY = 0x03,
   ANTIALIASED_QUALITY = 0x04,
   CLEARTYPE_QUALITY = 0x05
 } FontQuality;
https://msdn.microsoft.com/en-us/library/cc250391.aspx

This works under Windows only.
Use the source, Luke!

marksatterfield
Knows some wx things
Knows some wx things
Posts: 33
Joined: Fri Jun 30, 2017 12:34 pm

Re: wxWidgets & ClearType

Post by marksatterfield » Fri Oct 26, 2018 6:58 pm

Thanks! :)

Post Reply