From: Vadim Zeitlin Date: Tue, 24 Nov 2009 00:02:05 +0000 (+0000) Subject: Don't return italic/bold suffix from wxFont::GetFaceName() in wxMSW. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/804250acc385078b8a2ca0fba5d45062999a2e9d?ds=inline Don't return italic/bold suffix from wxFont::GetFaceName() in wxMSW. These suffixes don't make part of the face name in wx API but the native MSW API which we use since r62675 does return them. This made the unit test fail in SettingsTestCase::GlobalFonts() as a face name with such suffix wasn't recognized as a valid face name any more, so simply remove them. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62708 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/font.cpp b/src/msw/font.cpp index d7931aabf0..fde6b86faf 100644 --- a/src/msw/font.cpp +++ b/src/msw/font.cpp @@ -189,6 +189,14 @@ public: facename = GetMSWFaceName(); if ( !facename.empty() ) { + // the face name returned by GetOutlineTextMetrics() may have + // these suffixes which we don't count as part of face name + // because we have separate fields for them so remove them + wxString basename; + if ( facename.EndsWith(wxS(" Italic"), &basename) || + facename.EndsWith(wxS(" Bold"), &basename) ) + facename = basename; + // cache the face name, it shouldn't change unless the family // does and wxNativeFontInfo::SetFamily() resets the face name const_cast(this)->SetFaceName(facename);