The font smoothing of text is determined by the font that you select into the device. To learn about the options offered by the raw Win32 interface, read the LOGFONT
documentation.
In Delphi the underlying Win32 API font API is wrapped up by the TFont
class. The property that is pertinent to this question is Quality
. The default value is fqDefault
which uses the system-wide font smoothing setting. You want to set Quality
to either fqAntialiased
or fqNonAntialiased
.
Older versions of Delphi do not have this property. In which case you will need to call CreateFontIndirect
to create an HFONT
with the required quality settings. You can call this function immediately 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.