]> git.saurik.com Git - wxWidgets.git/commitdiff
Don't return italic/bold suffix from wxFont::GetFaceName() in wxMSW.
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 24 Nov 2009 00:02:05 +0000 (00:02 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 24 Nov 2009 00:02:05 +0000 (00:02 +0000)
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

index d7931aabf067f8cd261fb72de69d8c5791346d97..fde6b86faf1945b674ec0ec6a93d250df3b64209 100644 (file)
@@ -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<wxFontRefData *>(this)->SetFaceName(facename);