Skip to content

Persist font settings via Windows Registry#18

Merged
forloopcodes merged 5 commits intomainfrom
copilot/change-default-font-settings
Feb 4, 2026
Merged

Persist font settings via Windows Registry#18
forloopcodes merged 5 commits intomainfrom
copilot/change-default-font-settings

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 4, 2026

Font preferences (name and size) were not persisted across application restarts. Users had to reconfigure from Consolas 16pt every time.

Changes

New module: src/modules/settings.cpp

  • LoadFontSettings() - reads from HKCU\Software\LegacyNotepad on startup
  • SaveFontSettings() - writes when user changes font via Format menu
  • Font size validated to 8-72pt range

Integration points:

  • main.cpp - loads settings before window creation
  • dialog.cpp - saves settings after FormatFont() completes
  • CMakeLists.txt - added to build

Implementation

Registry values:

  • FontName (REG_SZ) - font face name
  • FontSize (REG_DWORD) - point size

Gracefully falls back to hardcoded defaults if registry key doesn't exist. Uses same registry pattern as existing theme.cpp.

void LoadFontSettings()
{
    HKEY hKey;
    if (RegOpenKeyExW(HKEY_CURRENT_USER, SETTINGS_KEY, 0, KEY_READ, &hKey) == ERROR_SUCCESS)
    {
        // Read FontName and FontSize, validate, close key
        // Falls back to g_state defaults if values invalid
    }
}
Original prompt

This section details on the original issue you should resolve

<issue_title>Not possible to change default font, font size etc</issue_title>
<issue_description>Hi and thanks for this app!

Legacy Notepad always reverts to Consolas, Regular, 16.

16 is way too big.

Not sure what the best approach is, either put a .ini or .cfg file in the same folder as the .exe, or maybe just store it in the registry.

Or maybe I'm missing something.

Have a nice day/evening</issue_description>

Comments on the Issue (you are @copilot in this section)

@forloopcodes on it

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 4 commits February 4, 2026 04:21
Co-authored-by: ForLoopCodes <89027512+ForLoopCodes@users.noreply.github.com>
Co-authored-by: ForLoopCodes <89027512+ForLoopCodes@users.noreply.github.com>
Co-authored-by: ForLoopCodes <89027512+ForLoopCodes@users.noreply.github.com>
Co-authored-by: ForLoopCodes <89027512+ForLoopCodes@users.noreply.github.com>
Copilot AI changed the title [WIP] Add functionality to change default font and size Persist font settings via Windows Registry Feb 4, 2026
Copilot AI requested a review from forloopcodes February 4, 2026 04:27
@forloopcodes forloopcodes merged commit 08dfcec into main Feb 4, 2026
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.

Not possible to change default font, font size etc

2 participants