From 1379e3dfb5e3898f1a02565d8f1d336b461bb79b Mon Sep 17 00:00:00 2001 From: 0tkl <118708188+0tkl@users.noreply.github.com> Date: Sun, 31 Dec 2023 15:13:06 +0800 Subject: [PATCH] Use parent's font for warning text in preferences 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. --- src/preferences.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/preferences.cpp b/src/preferences.cpp index 1b0033b057..6afd5f5d43 100644 --- a/src/preferences.cpp +++ b/src/preferences.cpp @@ -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);