From 804250acc385078b8a2ca0fba5d45062999a2e9d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 24 Nov 2009 00:02:05 +0000 Subject: [PATCH] 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 --- src/msw/font.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) 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); -- 2.50.0