1

I would like to perform a overall font size increment in a InnoSetup installer, by an arbitrary multiplier factor (let's say 1.5x) or a percent value (let's say 150%).

This means changing the font size of ALL the controls that displays a text in the wizard pages (labels, textboxes, checkboxes, etc).

I'm allowed to set the WizardStyle directive to "Modern" if required to allow bigger texts to be shown properly within the wizard page. WizardResizable directive should be False.

Basically I'm requesting to learn how to do something similar like what WizardSizePercent directive does, but in my case something that is also able to change the font size of controls.

I'm not sure if I can already use one of the built-in directives for this. I didn't found anything in the docs.

I only found limited font sizes that I can change in the LangOptions section. I think none of these directives affects the font size of the controls within the wizard pages, except for the WelcomeFontSize directive.

Then, how could I achieve this?. Maybe with pascal-script I could do a for loop to iterate all the controls of the active wizard page and change the font size of each one?. Someone could provide an example of this for loop?.

UPDATE:

Thanks to ChatGPT AI and a lot of research from my side, "we" managed to partially achieve the task that performs an overall font text increase, with this code:

[Code]

procedure ChangeFontSize(Page: TWizardPage; Percent: Double);
var
  Index: Integer;
  Control: TControl;
  StaticText: TNewStaticText;
  PreviousSize: Integer;
  NewSize: Integer;
  PercentString: String;
begin
  for Index := 0 to Page.Surface.ControlCount - 1 do
  begin
    Control := Page.Surface.Controls[Index];
    if Control is TNewStaticText then
    begin
      StaticText := TNewStaticText(Control);
      PreviousSize := StaticText.Font.Size;
      PercentString := Copy(FloatToStr(Percent * 100), 1, 3) + '%'
      NewSize := Round(PreviousSize * Percent);
      StaticText.Font.Size:= NewSize;
      // MsgBox(Format('Control Name: %s' + #13#10 + 
      //               'Previous Size: %d' + #13#10 +
      //               'New Size: %d' + #13#10 + 
      //               'Percent: %s', [Control.Name, PreviousSize, NewSize, PercentString]), mbInformation, MB_OK);
    end;
  end;
end;

procedure InitializeWizard();
var
  Pages: array of Integer;
  Page: TWizardPage;
  Index: Integer;
  Percent: Double;
begin
  Pages := [wpWelcome, wpLicense, wpPassword, wpInfoBefore, 
            wpUserInfo, wpSelectDir, wpSelectComponents, 
            wpSelectProgramGroup, wpSelectTasks, wpReady, 
            wpPreparing, wpInstalling, wpInfoAfter, wpFinished];
            
  for Index := 0 to Length(Pages) - 1 do
  begin
    Page := PageFromID(Pages[Index])
    Percent := 1.50  // +50% size increment
    ChangeFontSize(Page, Percent);
  end;
end;

The problems:

  1. Some controls (see the image below) are not iterated in the loop of the code above. I think this is due "Page.Surface.Controls" does not contain those controls, or maybe the condition: "if Control is TNewStaticText" is of different type.

  2. The font size of some controls are increased, yes, however, their bounds are not automatically adapted to this new size, so the text becomes unintelligible (see the image below).

enter image description here


This code update I think it almost fixes 1st problem, and makes a tiny little better work around 2nd problem, however still imperfect (useless):

[Code]

procedure ChangeFontSize(Page: TWizardPage; Percent: Double);
var
  Index: Integer;
  Control: TControl;
  PercentString: String;
  PreviousFontSize, NewFontSize: Integer;
  NewControlWidth, NewControlHeight: Integer;
begin
  for Index := 0 to Page.Surface.ControlCount - 1 do
  begin
    Control := Page.Surface.Controls[Index];
    
    if Control is TButton then
      PreviousFontSize := TButton(Control).Font.Size
    else if Control is TCheckBox then
      PreviousFontSize := TCheckBox(Control).Font.Size
    else if Control is TComboBox then
      PreviousFontSize := TComboBox(Control).Font.Size
    else if Control is TEdit then
      PreviousFontSize := TEdit(Control).Font.Size
    else if Control is TForm then
      PreviousFontSize := TForm(Control).Font.Size
    else if Control is TLabel then
      PreviousFontSize := TLabel(Control).Font.Size
    else if Control is TListBox then
      PreviousFontSize := TListBox(Control).Font.Size
    else if Control is TMemo then
      PreviousFontSize := TMemo(Control).Font.Size
    else if Control is TNewCheckListBox then
      PreviousFontSize := TNewCheckListBox(Control).Font.Size
    else if Control is TNewStaticText then
      PreviousFontSize := TNewStaticText(Control).Font.Size
    else if Control is TPanel then
      PreviousFontSize := TPanel(Control).Font.Size
    else if Control is TPasswordEdit then
      PreviousFontSize := TPasswordEdit(Control).Font.Size
    else if Control is TRadioButton then
      PreviousFontSize := TRadioButton(Control).Font.Size
    else
      Continue;
    
    PercentString := Copy(FloatToStr(Percent * 100), 1, 3) + '%';
    NewFontSize := Round(PreviousFontSize * Percent);
    NewControlWidth :=  Round((Control.Width * NewFontSize) / PreviousFontSize)
    NewControlHeight :=  Round(Control.Height * Percent);
    
    if Control is TButton then
      TButton(Control).Font.Size := NewFontSize
    else if Control is TCheckBox then
      TCheckBox(Control).Font.Size := NewFontSize
    else if Control is TComboBox then
      TComboBox(Control).Font.Size := NewFontSize
    else if Control is TEdit then
      TEdit(Control).Font.Size := NewFontSize
    else if Control is TForm then
      TForm(Control).Font.Size := NewFontSize
    else if Control is TLabel then
      TLabel(Control).Font.Size := NewFontSize
    else if Control is TListBox then
      TListBox(Control).Font.Size := NewFontSize
    else if Control is TMemo then
      TMemo(Control).Font.Size := NewFontSize
    else if Control is TNewCheckListBox then
      TNewCheckListBox(Control).Font.Size := NewFontSize
    else if Control is TNewStaticText then
      TNewStaticText(Control).Font.Size := NewFontSize
    else if Control is TPanel then
      TPanel(Control).Font.Size := NewFontSize
    else if Control is TPasswordEdit then
      TPasswordEdit(Control).Font.Size := NewFontSize
    else if Control is TRadioButton then
      TRadioButton(Control).Font.Size := NewFontSize
    else
      Continue;
     
    Control.Width := NewControlWidth;
    Control.Height := NewControlHeight;
    
    // Control.Top := ...
    // Control.Left := ...
    
    // WizardForm.ClientWidth := Round(WizardForm.ClientWidth * Percent);
    
    //   MsgBox(Format('Control Name: %s' + #13#10 +
    //                 'Previous Size: %d' + #13#10 +
    //                 'New Size: %d' + #13#10 +
    //                 'Percent: %s', [Control.Name, PreviousFontSize, NewFontSize, PercentString]), mbInformation, MB_OK);  
    
  end;
end;

procedure InitializeWizard();
var
  Pages: array of Integer;
  Page: TWizardPage;
  Index: Integer;
  Percent: Double;
begin
  Pages := [wpWelcome, wpLicense, wpPassword, wpInfoBefore,
            wpUserInfo, wpSelectDir, wpSelectComponents,
            wpSelectProgramGroup, wpSelectTasks, wpReady,
            wpPreparing, wpInstalling, wpInfoAfter, wpFinished];

  for Index := 0 to Length(Pages) - 1 do
  begin
    Page := PageFromID(Pages[Index])
    Percent := 1.80  // +50% size increment
    ChangeFontSize(Page, Percent);
  end;
end;

enter image description here

ElektroStudios
  • 19,105
  • 33
  • 200
  • 417

1 Answers1

1

The DialogFontSize is actually applied to the installation wizard:

[LangOptions]
DialogFontSize=12

enter image description here

Versus the default size (8):

enter image description here

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
  • Thank you, but do you know if can keep the window size proportionally?. I mean, DialogFontSize also increases the size of the form in a very exorbitant way. With DialogFontSize=24 the window size literally gets out of the bounds of my 1080p screen. It increases the font size but it also makes the form size too much huge for that. – ElektroStudios Mar 20 '23 at 12:23
  • I've tried `DialogFontSize=24`, and the window seems to be sized correctly: https://i.stack.imgur.com/rQWHw.png – Martin Prikryl Mar 20 '23 at 12:40
  • this is 24 on my side: https://i.imgur.com/VE5y1n6.png also now I noticed a label does not get resized, while in your screenshot it is. Strange. – ElektroStudios Mar 20 '23 at 18:10
  • I do not find your window proportionally out of scale. In the default font size, the labels are placed proportionally exactly the same. + The "Welcome" label has its own font size: `WelcomeFontSize`. – Martin Prikryl Mar 21 '23 at 06:33
  • The form its very (ridiculously too) huge just to allow a text font of that size. I understand the fault is of the internal logic of that 'DialogFontSize' directive which their developers did the things in that ugly and bothering way, its not your fault of course. But this is not exactly the behavior what I'm looking for. I would like to increase text, but to fit that text (resizing and positioning the controls) into the form bounds, without growing it that huge. Anyway, I appreciate your help and answer so I marked it as accepted as a token of consideration and appreciation for your time. – ElektroStudios Mar 21 '23 at 21:39
  • 1
    Imo the dialog scales proportionally to the font size. You may not like it. But that's imo far from *"ugly and bothering"*. If you want to resize the dialog unproportionally to the font size, you cannot really expect an easy solution. You will have to go control-by-control and carefully re-locate and re-size it to fit your custom desires. See for example my IS5 solution at [How to change wizard size (width and height) in an Inno Setup installer?](https://stackoverflow.com/q/11778292/850848) – Martin Prikryl Mar 22 '23 at 06:33