is there a method to set the font quality for text in the richviewedit?
LOGFONT logFont;
logFont.lfHeight = 8;
logFont.lfWidth = 0;
logFont.lfEscapement = 0;
logFont.lfOrientation = 0;
logFont.lfWeight = FW_NORMAL;
logFont.lfItalic = 0;
logFont.lfUnderline = 0;
logFont.lfStrikeOut = 0;
logFont.lfCharSet = ANSI_CHARSET;
logFont.lfOutPrecision = OUT_DEFAULT_PRECIS;
logFont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
logFont.lfQuality = PROOF_QUALITY;
font qulalitiy
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
There are no direct properties for changing a font quality.
A solution is possible using TRVStyle.OnApplyStyle event:
This solution has the following problems:
1) it applies only to text; bullet and numbering still use the system settings
2) this solution ignores bidirected text properties, so it can be used only if your application does not need to support Arabic or Hebrew.
A solution is possible using TRVStyle.OnApplyStyle event:
Code: Select all
// code for RVStyle.OnApplyStyle event
procedure TForm1.RVStyle1ApplyStyle(Sender: TRVStyle; Canvas: TCanvas;
StyleNo: Integer; var DoDefault: Boolean);
var LogFont: TLogFont;
tm: TTextMetric;
TextStyle: TFontInfo;
begin
DoDefault := False;
TextStyle := Sender.TextStyles[StyleNo];
TextStyle.AssignToLogFont(LogFont, Canvas, True, False, False);
LogFont.lfQuality := 3 {NONANTIALIASED_QUALITY};
Canvas.Font.Handle := CreateFontIndirect(LogFont);
// supporting CharScale property
if TextStyle.CharScale<>100 then begin
if GetTextMetrics(Canvas.Handle, tm) then
LogFont.lfWidth := tm.tmAveCharWidth*TextStyle.CharScale div 100
else
LogFont.lfWidth := Canvas.TextWidth('x')*TextStyle.CharScale div 100;
Canvas.Font.Handle := CreateFontIndirect(LogFont);
end;
// supporting CharSpacing property
SetTextCharacterExtra(Canvas.Handle, TextStyle.CharSpacing);
end;
This solution has the following problems:
1) it applies only to text; bullet and numbering still use the system settings
2) this solution ignores bidirected text properties, so it can be used only if your application does not need to support Arabic or Hebrew.