]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix wxFont::GetFaceName() for not realized yet fonts in wxMSW.
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 16 Sep 2011 22:44:04 +0000 (22:44 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 16 Sep 2011 22:44:04 +0000 (22:44 +0000)
GetFaceName() could be called for a font that hadn't been really used yet and
hence its wxFontRefData::m_hFont could be 0 and couldn't be used in
GetMSWFaceName().

Fix this by using GetHFONT() accessor instead of m_hFont directly to create
the font if necessary.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69106 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/font.cpp

index d995db91ac7e54cd9f4fc5851f517a4aa55447f3..376b8b3b870865afb7fd5eba664763d96417f6c1 100644 (file)
@@ -279,7 +279,7 @@ protected:
     wxString GetMSWFaceName() const
     {
         ScreenHDC hdc;
-        SelectInHDC selectFont(hdc, m_hFont);
+        SelectInHDC selectFont(hdc, (HFONT)GetHFONT());
 
         UINT otmSize = GetOutlineTextMetrics(hdc, 0, NULL);
         if ( !otmSize )