From: Stefan Csomor Date: Fri, 2 Apr 2004 08:29:26 +0000 (+0000) Subject: supporting non-theme fonts X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/943b730f1f696969e91b21b1f4160dcfc1ff9a9c supporting non-theme fonts git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26577 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/mac/carbon/stattext.cpp b/src/mac/carbon/stattext.cpp index c6a6dd4e1a..3536eb11e9 100644 --- a/src/mac/carbon/stattext.cpp +++ b/src/mac/carbon/stattext.cpp @@ -66,7 +66,16 @@ wxSize wxStaticText::DoGetBestSize() const Point bounds ; SInt16 baseline ; wxMacCFStringHolder str(m_label , m_font.GetEncoding() ) ; - verify_noerr( GetThemeTextDimensions( (m_label.Length() > 0 ? ((CFStringRef) str ) : CFSTR(" ") ) , m_font.MacGetThemeFontID() , kThemeStateActive , false , &bounds , &baseline ) ) ; + if ( m_font.MacGetThemeFontID() != kThemeCurrentPortFont ) + verify_noerr( GetThemeTextDimensions( (m_label.Length() > 0 ? ((CFStringRef) str ) : CFSTR(" ") ) , m_font.MacGetThemeFontID() , kThemeStateActive , false , &bounds , &baseline ) ) ; + else + { + wxMacWindowStateSaver sv( this ) ; + ::TextFont( m_font.MacGetFontNum() ) ; + ::TextSize( (short)( m_font.MacGetFontSize()) ) ; + ::TextFace( m_font.MacGetFontStyle() ) ; + verify_noerr( GetThemeTextDimensions( (m_label.Length() > 0 ? ((CFStringRef) str ) : CFSTR(" ") ) , kThemeCurrentPortFont , kThemeStateActive , false , &bounds , &baseline ) ) ; + } if ( m_label.Length() == 0 ) bounds.h = 0 ; return wxSize(bounds.h, bounds.v);