From 71d4b88bdf8a9d71f70e63bd70877e0f73f7ce8e Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 16 Jul 2008 15:53:44 +0000 Subject: [PATCH] allow using SetFont(wxNullFont) to reset the font as per documented behaviour (#3238) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@54664 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + src/msw/window.cpp | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/changes.txt b/docs/changes.txt index 1a2f2fae30..23dc7dc0e8 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -121,6 +121,7 @@ wxMSW: - Compile fix for WinCE in window.cpp (no VkKeyScan in Windows CE). - Fix quoting of arguments passed to wxExecute(char **) (Brian Ravnsgaard Riis). - Support disabling items before adding them to the menu (Christian Walther). +- Allow to call SetFont(wxNullFont) to reset the font to default. wxGTK: diff --git a/src/msw/window.cpp b/src/msw/window.cpp index e11964ab57..57ed9d3794 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -811,7 +811,11 @@ bool wxWindowMSW::SetFont(const wxFont& font) HWND hWnd = GetHwnd(); if ( hWnd != 0 ) { - WXHANDLE hFont = m_font.GetResourceHandle(); + // note the use of GetFont() instead of m_font: our own font could have + // just been reset and in this case we need to change the font used by + // the native window to the default for this class, i.e. exactly what + // GetFont() returns + WXHANDLE hFont = GetFont().GetResourceHandle(); wxASSERT_MSG( hFont, wxT("should have valid font") );