Skip to content

Commit

Permalink
Use parent's font for warning text in preferences
Browse files Browse the repository at this point in the history
The original code used wxFONTFAMILY_SWISS to set a bold sans-serif
font for the warning message in Preferences/Advanced, assuming that:
1. SWISS always returns a sans-serif font.
2. The system UI font is universally sans-serif across all locales.

However, the first assumption is incorrect, and the second one *was*
incorrect. On modern Windows under Chinese locales, SWISS will return
SimSun or PMingLiU, which are serif fonts with embedded bitmaps that
are distributed with legacy Windows as the default interface fonts.

The commit fixes the issue by using the parent's font and making
it bold instead of directly constructing a wxFont with SWISS.
  • Loading branch information
0tkl authored and arch1t3cht committed Jan 3, 2025
1 parent a09565a commit fdac697
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/preferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,9 @@ void Advanced(wxTreebook *book, Preferences *parent) {
auto general = p->PageSizer(_("General"));

auto warning = new wxStaticText(p, wxID_ANY ,_("Changing these settings might result in bugs and/or crashes. Do not touch these unless you know what you're doing."));
warning->SetFont(wxFont(12, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD));
auto font = parent->GetFont().MakeBold();
font.SetPointSize(12);
warning->SetFont(font);
p->sizer->Fit(p);
warning->Wrap(400);
general->Add(warning, 0, wxALL, 5);
Expand Down

0 comments on commit fdac697

Please sign in to comment.