Setting Segoe UI Light programmatically in TJvWizard

773 views Asked by At

I'm using a TJvWizard component and I want to set its header Title font to use Segoe UI Light. In my form OnCreate method I'm doing the following:

procedure TForm1.FormCreate(Sender: TObject);
var
  i: Integer;
begin
  for i := 0 to JvWizard1.PageCount - 1 do
  begin
    JvWizard1.Pages[i].Header.ParentFont := false;
    JvWizard1.Pages[i].Header.Title.Font.Size := 16;
    JvWizard1.Pages[i].Header.Title.Font.Name := 'Segoe UI Light';
  end;
end;

This code sets the font size correctly but the Font doesn't change to Segoe UI Light, instead it keeps using the parent font (which is Segoe UI.)

As a workaround, I did this:

procedure TForm1.FormCreate(Sender: TObject);
var
  i: Integer;
  f: TFont;
begin
  f := TFont.Create;
  f.Name := 'Segoe UI Light';
  f.Size := 16;
  for i := 0 to JvWizard1.PageCount - 1 do
  begin
    JvWizard1.Pages[i].Header.Title.Font.Assign(f);
  end;
  f.Free;
end;

This does the trick, but it smells funny to me. Also, I don't know how Assign works. Does it keeps a reference? Should I keep the f.Free line?

Edit: As additional information, I have Office 2013 installed with a fairly recent version of these fonts. I've also observed that I cannot select Segoe UI Light in other applications, for example, InkScape.

Also, in the Delphi property editor, I can select it using the Font select dialog, but the name "Segoe UI Light" doesn't appear; instead, I have to select Segoe UI and in the Font Style list I select the Light style.

Font dialog

Also, selecting the font name using the drop-down list doesn't work either:

Font name from Property Inspector not set

So, I think this has to do with the font version I have, and some extended properties (in fact, in my Fonts folder I can only see Segoe UI, and opening it will open 10 windows.)

Segoe UI in the Windows Font folder

I'm still looking around for a workaround (this sounds like it may be related, but they didn't follow it)

0

There are 0 answers