wxWidgets & ClearType Topic is solved
-
- In need of some credit
- Posts: 9
- Joined: Wed Jun 11, 2008 9:35 am
wxWidgets & ClearType
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!
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!
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
-
- In need of some credit
- Posts: 9
- Joined: Wed Jun 11, 2008 9:35 am
Thanks for your answer. I tried the flags but they dont seem to work.
I also found this function:
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.
I also found this function:
Code: Select all
wxFont::SetNoAntiAliasing(bool);
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.
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
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!
-
- In need of some credit
- Posts: 9
- Joined: Wed Jun 11, 2008 9:35 am
-
- Knows some wx things
- Posts: 33
- Joined: Fri Jun 30, 2017 12:34 pm
Re: wxWidgets & ClearType
Did anyone actually post the explanation on how to do this?
Re: wxWidgets & ClearType
The string you get from GetNativeFontInfoDesc() looks like this:
The 13th value, in this case "3" is the FontQuality.
Possible values are: https://msdn.microsoft.com/en-us/library/cc250391.aspx
This works under Windows only.
Code: Select all
"0;-24;0;0;0;400;0;0;0;1;0;0;3;32;Lucida Sans Unicode"
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;
This works under Windows only.
Use the source, Luke!
-
- Knows some wx things
- Posts: 33
- Joined: Fri Jun 30, 2017 12:34 pm
Re: wxWidgets & ClearType
Thanks!
Re: wxWidgets & ClearType
doublemax wrote: ↑Fri Oct 26, 2018 4:56 pm The string you get from GetNativeFontInfoDesc() looks like this:The 13th value, in this case "3" is the FontQuality.Code: Select all
"0;-24;0;0;0;400;0;0;0;1;0;0;3;32;Lucida Sans Unicode"
Possible values are:https://msdn.microsoft.com/en-us/library/cc250391.aspxCode: Select all
typedef enum { DEFAULT_QUALITY = 0x00, DRAFT_QUALITY = 0x01, PROOF_QUALITY = 0x02, NONANTIALIASED_QUALITY = 0x03, ANTIALIASED_QUALITY = 0x04, CLEARTYPE_QUALITY = 0x05 } FontQuality;
This works under Windows only.
Hi, doublemax, first, thanks for the great answer.
With this answer, I can now enable the "smooth font" in the Code::Blocks with the legacy GDI font render inside the wxScintilla control. (also the font wx sample).
But please note that the index has changed from 13 to 14, which takes me several hours to find the reason. I have use the wx font sample to debug into the wx library.
See details here:
font rendering issue when using C::B under windows remote desktop