X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/facd6764872eede45605ba7c9dfa0e1d0c708fa2..23176131010f41b2f9a54bef50c8afa25472e195:/src/mac/carbon/stattext.cpp diff --git a/src/mac/carbon/stattext.cpp b/src/mac/carbon/stattext.cpp index 8437b9d5d1..3536eb11e9 100644 --- a/src/mac/carbon/stattext.cpp +++ b/src/mac/carbon/stattext.cpp @@ -66,8 +66,18 @@ wxSize wxStaticText::DoGetBestSize() const Point bounds ; SInt16 baseline ; wxMacCFStringHolder str(m_label , m_font.GetEncoding() ) ; - verify_noerr( GetThemeTextDimensions( str , 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); }