Fastest way to change fonts globably

General TRichView support forum. Please post your questions here
Post Reply
jgkoehn
Posts: 294
Joined: Thu Feb 20, 2020 9:32 pm

Fastest way to change fonts globably

Post by jgkoehn »

Is there a fast way to change an entire text style fontname and then it is applied globably to a RichViewEdit?
jgkoehn
Posts: 294
Joined: Thu Feb 20, 2020 9:32 pm

Re: Fastest way to change fonts globably

Post 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;
Post Reply