The font smoothing of the text is determined by the font that you select in the device. For information on the options offered by the raw Win32 interface, read the LOGFONT documentation.
In Delphi, the core Win32 API ends with the TFont class. The property related to this issue is Quality . The default value is fqDefault , which uses the system font smoothing setting. You want to set Quality to fqAntialiased or fqNonAntialiased .
Older versions of Delphi do not have this property. In this case, you will need to call CreateFontIndirect to create the HFONT with the required quality settings. You can call this function just before you start drawing text:
procedure SetFontQuality(Font: TFont; Quality: Byte); var LogFont: TLogFont; begin if GetObject(Font.Handle, SizeOf(TLogFont), @LogFont) = 0 then RaiseLastOSError; LogFont.lfQuality := Quality; Font.Handle := CreateFontIndirect(LogFont); end;
Pass either NONANTIALIASED_QUALITY or ANTIALIASED_QUALITY depending on your needs.
David heffernan
source share