I see a number of different Font properties dispersed throughout the various objects in WPTools 5. Which one of them corresponds closest in concept to <TWPRichText>.Font?
diamond
I see a number of different Font properties dispersed throughout the various objects in WPTools 5. Which one of them corresponds closest in concept to <TWPRichText>.Font?
diamond
Hi,
Using 'Font' always was a bad idea because:
a) the TFont only offers a sub sub selections of available characteristics
b) There is no way to change only part of the definition - a TFont always defines name, color AND size.
So, as conclusin do not use 'Font' at ll. If you really need to use a TFont object there is the
function TWPCustomRichText.UpdateFontValues : TFont;
to retrieve a TFont object and the method ApplyFont to assign one.
Example: The font dialog procedure uses the TFont methods:
function TWPCustomRichText.FontSelect : Boolean;
var
FontDialog1: TFontDialog;
BlockAttr: TWPBlockAttribute;
begin
Result := FALSE;
if Changing then
begin
FontDialog1 := nil;
try
FontDialog1 := TFontDialog.Create(Self);
if Printer.Printers.Count > 0 then
FontDialog1.Device := fdPrinter;
if Memo.Selected then
begin
Memo.GetBlockAttr(BlockAttr, TRUE);
// Also assigns the asttributes to 'Attr'
if BlockAttr.FontDiffers then
FontDialog1.Options := FontDialog1.Options + [fdNoFaceSel];
if BlockAttr.SizeDiffers then
FontDialog1.Options := FontDialog1.Options + [fdNoSizeSel];
end;
FontDialog1.Font.Assign(UpdateFontValues);
if FontDialog1.Execute then
begin
ApplyFont(FontDialog1.Font);
Changed;
Result := TRUE;
end;
finally
FontDialog1.Free;
end;
Changed;
end;
end;
Alles anzeigen
So instead of 'Font' use CurrAttr
Julian Ziersch