Skip to content

Feature/change font size - #667

Draft
DiggiDoggi wants to merge 22 commits into
castle-engine:masterfrom
DiggiDoggi:feature/change_font_size
Draft

DiggiDoggi wants to merge 22 commits into
castle-engine:masterfrom
DiggiDoggi:feature/change_font_size

Conversation

@DiggiDoggi

Copy link
Copy Markdown

Added an ability to change the font size across the CGE editor forms, with optional change to the TSplitter size, in a bid to make them more visible on high resolution displays.
It's been done the way that doesn't need much maintenance or changes to the current code.
The user preferences are stored in UserConfig, and can be completely switched off by one click on FormPreferences.
The font size can be applied to the menu / popup menu, and it can be switched off independently.

To implement the style setting on a new form it's enough if you add StyleUtils to USES clause, and OnFormShow should call either:

  • StyleUtils.UpdateAll(Self) to apply user preferences to everything, (including menus if user selected that option),
  • StyleUtils.UpdateControlStyle(SomeControl,...) to selectively change fonts on a particular control and it's children. It can be set to Self if you want to apply the changes to the whole form. It doesn't change menus. Additional 2 parameters give you control over following behaviors: A) If you want to ignore ParentFont, B) if labels that use italic text should have lower size. For example, some labels on PreferencesForm are using italics for less important info, and they shouldn't clutter the interface when we change font size. More fine-tune is possible in StyleUtilsSetSingleControlStyle.
  • StyleUtils.UpdateMenuStyle(x) where x can be TMenuItem, or a descendant of TMenu. It's changing the appearance of the given menu item, popup or main menu item, and its children. It must be called when you dynamically create menus.

In that way the code requires very little to adapt to font changes.
Also the code has been made with simplicity on mind. It could be improved but I didn't want to make it a maintenance burden.

The FormPreferences has been redesigned. Git will report hundreds of changes, but in fact only the 'tabs' were changed to TScrollBox from old TPanel, as with increased font size some setting options can go out of the view.

The FormAbout has an extra code to make sure that form's size is aligned with increased size of the labels. In that way design is kept in its original style and feel. With bigger fonts, the copyright label was going outside the form. I could make it WordWrap, but it looked very bad that way.

FormProject and FrameDesign have an extra code in UpdateStyle procedure to adapt to the font changes.

The FormChooseProject has been left almost unchanged - only the popup menu to select recent projects can change font size. Change of the font size on the form would break the design, so I left it as it is.

Other changes were very minor, if any.

I have tested it on windows 11 with different font sizes, also with system-wide scale changes and different resolutions. Although font size of 18 should be OK for 8k display, I'd recommend using sizes in range of 7-13. The hard limit is 7-18.

DiggiDoggi and others added 22 commits March 6, 2025 11:35
Next stage -> Clean some code if tests on other systems return OK
Cleaning the code from not needed (commented) stuff.
As we can now disable the whole plugin, menu handler is created on demand.
All major forms are now style-compatible, typically by simple call inside
their OnShow().
Changed procedure name UpdateMenu to UpdateMenuStyle to make clear what the procedure does.
@DiggiDoggi
DiggiDoggi marked this pull request as draft July 3, 2025 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant