Skip to content

Add xg_lfSmallLogFont (LOGFONTW) for small font management with backward compatibility - #94

Merged
katahiromz merged 2 commits into
masterfrom
copilot/add-small-log-font-support
Jul 2, 2026
Merged

Add xg_lfSmallLogFont (LOGFONTW) for small font management with backward compatibility#94
katahiromz merged 2 commits into
masterfrom
copilot/add-small-log-font-support

Conversation

Copilot AI commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Adds xg_lfSmallLogFont (LOGFONTW) as the internal representation for the small font setting, complementing the existing xg_szSmallFont string. Board rendering now uses xg_lfSmallLogFont directly. Font size remains dynamically computed from cell size — the LOGFONTW struct carries only face name and style properties, never size fields.

Changes

New global (XG_Settings.hpp, GUI.cpp)

  • LOGFONTW xg_lfSmallLogFont = {} — always has lfHeight = lfWidth = 0; size is computed at draw time in XgCreateSmallFont()

Drawing (XWordGiver.cpp)

  • XgCreateSmallFont() now mirrors XgCreateNormalFont(): starts from xg_lfSmallLogFont, overrides size fields dynamically, falls back to defaults for weight/quality/charset if unset

LOOKS file I/O (GUI.cpp, XG_SettingsDialog.cpp)

  • Import: reads SmallFont (compat) then SmallLogFont (hex-encoded LOGFONTW via XgHexToBin); SmallLogFont wins if valid, otherwise falls back to SmallFont face name
  • Export: writes both SmallFont and SmallLogFont (XgBinToHex) every time

Registry I/O (GUI.cpp)

  • Reads/writes SmallLogFont as a struct (size fields zeroed on write, same pattern as CellLogFont)

Settings dialog (XG_SettingsDialog.cpp)

  • On OK: syncs xg_lfSmallLogFont.lfFaceName from edt2 alongside xg_szSmallFont
  • Font chooser for small font (case 1): initializes ChooseFontW from xg_lfSmallLogFont instead of bare face name
  • DoImportLooks / DoExportLooks: reads/writes SmallLogFont in addition to SmallFont

Existing LOOKS files with only SmallFont continue to work unchanged — xg_lfSmallLogFont is populated from the face name string as a fallback.

@katahiromz
katahiromz marked this pull request as ready for review July 2, 2026 02:15
Copilot AI changed the title [WIP] Add support for small log font management Add xg_lfSmallLogFont (LOGFONTW) for small font management with backward compatibility Jul 2, 2026
Copilot AI requested a review from katahiromz July 2, 2026 02:17
@katahiromz
katahiromz merged commit 9ad041c into master Jul 2, 2026
1 check passed
@katahiromz
katahiromz deleted the copilot/add-small-log-font-support branch July 2, 2026 02:18
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.

2 participants