[PR #19] [MERGED] Fix font style selection ignoring user-selected weight/italic/underline #24

Closed
opened 2026-03-03 12:01:47 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ForLoopCodes/legacy-notepad/pull/19
Author: @Copilot
Created: 2/4/2026
Status: Merged
Merged: 2/4/2026
Merged by: @ForLoopCodes

Base: mainHead: copilot/fix-technical-font-display


📝 Commits (4)

  • 3ecd82b Initial plan
  • e3371d7 Fix TECHNICAL font not displaying Regular style correctly
  • ff7c261 Final documentation and summary
  • 437b76e Update .gitignore to exclude build artifacts

📊 Changes

4 files changed (+12 additions, -2 deletions)

View changed files

📝 .gitignore (+2 -0)
📝 src/core/types.h (+3 -0)
📝 src/modules/dialog.cpp (+6 -1)
📝 src/modules/editor.cpp (+1 -1)

📄 Description

Font dialog selections were ignored during font creation. Selecting "TECHNICAL Regular" rendered as Bold because CreateFontW always used hardcoded FW_NORMAL instead of the user's chosen style.

Changes

  • AppState: Added fontWeight, fontItalic, fontUnderline fields to persist font attributes
  • FormatFont(): Extract and store lfWeight, lfItalic, lfUnderline from ChooseFontW result
  • ApplyFont(): Use stored attributes instead of hardcoded defaults when calling CreateFontW

Before/After

// Before: Ignored user selection
g_state.hFont = CreateFontW(height, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ...);

// After: Uses selected attributes
g_state.hFont = CreateFontW(height, 0, 0, 0, g_state.fontWeight, g_state.fontItalic, g_state.fontUnderline, FALSE, ...);

Affects all fonts with multiple weight/style variants, not just TECHNICAL.

Original prompt

This section details on the original issue you should resolve

<issue_title>legacy-notepad-x64 will not load up regular TECHNICAL font</issue_title>
<issue_description>Image

  • setting to regular TECHNICAL font sets BOLD instead
  • would like regular TECHNICAL font to display REGULAR
    </issue_description>

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

@ForLoopCodes lemme see

Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ForLoopCodes/legacy-notepad/pull/19 **Author:** [@Copilot](https://github.com/apps/copilot-swe-agent) **Created:** 2/4/2026 **Status:** ✅ Merged **Merged:** 2/4/2026 **Merged by:** [@ForLoopCodes](https://github.com/ForLoopCodes) **Base:** `main` ← **Head:** `copilot/fix-technical-font-display` --- ### 📝 Commits (4) - [`3ecd82b`](https://github.com/ForLoopCodes/legacy-notepad/commit/3ecd82be8bb7498e0029be6d04a06c99f7a1c694) Initial plan - [`e3371d7`](https://github.com/ForLoopCodes/legacy-notepad/commit/e3371d79c57706fb9c6ad817a88018ccdf86f64d) Fix TECHNICAL font not displaying Regular style correctly - [`ff7c261`](https://github.com/ForLoopCodes/legacy-notepad/commit/ff7c261c2d83643e98ea84da2751b02a53ee7e91) Final documentation and summary - [`437b76e`](https://github.com/ForLoopCodes/legacy-notepad/commit/437b76e346207567dc5a71edcbcc0b4140245aa0) Update .gitignore to exclude build artifacts ### 📊 Changes **4 files changed** (+12 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `.gitignore` (+2 -0) 📝 `src/core/types.h` (+3 -0) 📝 `src/modules/dialog.cpp` (+6 -1) 📝 `src/modules/editor.cpp` (+1 -1) </details> ### 📄 Description Font dialog selections were ignored during font creation. Selecting "TECHNICAL Regular" rendered as Bold because `CreateFontW` always used hardcoded `FW_NORMAL` instead of the user's chosen style. ## Changes - **AppState**: Added `fontWeight`, `fontItalic`, `fontUnderline` fields to persist font attributes - **FormatFont()**: Extract and store `lfWeight`, `lfItalic`, `lfUnderline` from `ChooseFontW` result - **ApplyFont()**: Use stored attributes instead of hardcoded defaults when calling `CreateFontW` ## Before/After ```cpp // Before: Ignored user selection g_state.hFont = CreateFontW(height, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ...); // After: Uses selected attributes g_state.hFont = CreateFontW(height, 0, 0, 0, g_state.fontWeight, g_state.fontItalic, g_state.fontUnderline, FALSE, ...); ``` Affects all fonts with multiple weight/style variants, not just TECHNICAL. <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> > > ---- > > *This section details on the original issue you should resolve* > > <issue_title>legacy-notepad-x64 will not load up regular TECHNICAL font</issue_title> > <issue_description>![Image](https://github.com/user-attachments/assets/2ab73dda-7fc2-4de6-a04e-b2d9220e6805) > > - setting to regular TECHNICAL font sets BOLD instead > - would like regular TECHNICAL font to display REGULAR > </issue_description> > > ## Comments on the Issue (you are @copilot in this section) > > <comments> > <comment_new><author>@ForLoopCodes</author><body> > lemme see</body></comment_new> > </comments> > </details> <!-- START COPILOT CODING AGENT SUFFIX --> - Fixes ForLoopCodes/legacy-notepad#10 <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/ForLoopCodes/legacy-notepad/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-03 12:01:47 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/legacy-notepad#24
No description provided.