I have a Delphi 7 application where I'm drawing text to a TBitmap
. I need to be able to control the anti-aliasing quality of the text. For this purpose I'm using the following procedure:
procedure SetFontQuality(Font: TFont; Quality: Byte);
var
lf: TLogFont;
begin
GetObject(Font.Handle, SizeOf(TLogFont), @lf);
lf.lfQuality := Quality;
Font.Handle := CreateFontIndirect(lf);
end;
I'm calling it for my TBitmap
like this: SetFontQuality(MyBitmap.Canvas.Font, ANTIALIASED_QUALITY)
. The goal here is to set the old anti-aliasing instead of the new ClearType one.
This works great, if I'm using DrawText
to draw the text on the TBitmap
.
However, I need to draw the text of a TRichEdit
on it, so I'm using EM_FORMATRANGE
for this purpose. But the text is drawn with whatever my Windows anti-aliasing is (so if I enable ClearType in Windows, it is ClearType, even if I set the old anti-aliasing with ANTIALIASED_QUALITY
).
I suppose I need to change the font quality of the TRichEdit
, so I applied the procedure to it: SetFontQuality(MyRichEdit.Font, ANTIALIASED_QUALITY)
, but that didn't change things.
I did a little bit of testing - I tried applying the procedure to the Font
property of various controls - TButton
, TMemo
, TEdit
, TLabel
. It works like a charm on all of them. But when applied to a TRichEdit
's Font
property, the anti-aliasing doesn't change.
So, my question is: how do I change the anti-aliasing quality of a TRichEdit control?