Always set the font to use in wxMSW wxTextMeasure when using a window.
The default window HDC font is not the same as the wxWindow font, so we need to always set the font explicitly in this case (when using a wxDC, its HDC does have the current wxDC font already selected into it, so doing it once again would be unnecessarily wasteful). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72845 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -69,8 +69,12 @@ void wxTextMeasure::BeginMeasuring()
|
||||
m_hdc = ::GetDC(GetHwndOf(m_win));
|
||||
}
|
||||
|
||||
if ( m_font )
|
||||
m_hfontOld = (HFONT)::SelectObject(m_hdc, GetHfontOf(*m_font));
|
||||
// We need to set the font if it's explicitly specified, of course, but
|
||||
// also if we're associated with a window because the window HDC created
|
||||
// above has the default font selected into it and not the font of the
|
||||
// window.
|
||||
if ( m_font || m_win )
|
||||
m_hfontOld = (HFONT)::SelectObject(m_hdc, GetHfontOf(GetFont()));
|
||||
}
|
||||
|
||||
void wxTextMeasure::EndMeasuring()
|
||||
|
Reference in New Issue
Block a user