Page 1 of 1

Fastest way to change fonts globably

Posted: Fri Nov 05, 2021 11:54 pm
by jgkoehn
Is there a fast way to change an entire text style fontname and then it is applied globably to a RichViewEdit?

Re: Fastest way to change fonts globably

Posted: Sat Nov 06, 2021 1:17 am
by jgkoehn
Ah I found a pretty fast way to do it based off Costas' code. RichViewEdit and RichView are almost identical.

Code: Select all

procedure FontReplace;
var
   i:Integer;
   RVEStyle: TRVStyle;
begin
//We are going to try to replace RichViewEdit font and we are aiming for speed.
    RVEStyle := RichViewEdit.Style;
    for i := 0 to RVEStyle.TextStyles.Count-1 do
      begin
       if String(RVEStyle.TextStyles[i].FontName) = String('Replacement FontVariable goes here - use defaults, Segoe UI, Gentium, Cardo unless set in the module') then
         RVEStyle.TextStyles[i].FontName := ' FontPref variable from theWord goes here ';
      end;
   RichViewEdit.Format;
end;