diff --git a/src/generic/graphicc.cpp b/src/generic/graphicc.cpp index f40b1c5845..2b2c0671f5 100644 --- a/src/generic/graphicc.cpp +++ b/src/generic/graphicc.cpp @@ -1253,7 +1253,9 @@ void wxCairoContext::DrawIcon( const wxIcon &icon, wxDouble x, wxDouble y, wxDou void wxCairoContext::DrawText( const wxString &str, wxDouble x, wxDouble y ) { - if ( m_font.IsNull() || str.empty()) + wxCHECK_RET( !m_font.IsNull(), wxT("wxCairoContext::DrawText - no valid font set") ); + + if ( str.empty()) return; ((wxCairoFontData*)m_font.GetRefData())->Apply(this); @@ -1271,7 +1273,9 @@ void wxCairoContext::DrawText( const wxString &str, wxDouble x, wxDouble y ) void wxCairoContext::GetTextExtent( const wxString &str, wxDouble *width, wxDouble *height, wxDouble *descent, wxDouble *externalLeading ) const { - if ( m_font.IsNull() || str.empty()) + wxCHECK_RET( !m_font.IsNull(), wxT("wxCairoContext::GetTextExtent - no valid font set") ); + + if ( str.empty()) return; ((wxCairoFontData*)m_font.GetRefData())->Apply((wxCairoContext*)this); @@ -1303,6 +1307,8 @@ void wxCairoContext::GetPartialTextExtents(const wxString& text, wxArrayDouble& widths.Empty(); widths.Add(0, text.length()); + wxCHECK_RET( !m_font.IsNull(), wxT("wxCairoContext::GetPartialTextExtents - no valid font set") ); + if (text.empty()) return; diff --git a/src/mac/carbon/graphics.cpp b/src/mac/carbon/graphics.cpp index 9257e7fc31..74b2173952 100755 --- a/src/mac/carbon/graphics.cpp +++ b/src/mac/carbon/graphics.cpp @@ -1758,8 +1758,7 @@ void wxMacCoreGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDoub void wxMacCoreGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDouble y, wxDouble angle ) { - if ( m_font.IsNull() ) - return; + wxCHECK_RET( !m_font.IsNull(), wxT("wxMacCoreGraphicsContext::DrawText - no valid font set") ); EnsureIsValid(); @@ -1873,7 +1872,7 @@ void wxMacCoreGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDoub void wxMacCoreGraphicsContext::GetTextExtent( const wxString &str, wxDouble *width, wxDouble *height, wxDouble *descent, wxDouble *externalLeading ) const { - wxCHECK_RET( !m_font.IsNull(), wxT("wxDC(cg)::DoGetTextExtent - no valid font set") ); + wxCHECK_RET( !m_font.IsNull(), wxT("wxMacCoreGraphicsContext::GetTextExtent - no valid font set") ); if ( width ) *width = 0; @@ -1951,6 +1950,8 @@ void wxMacCoreGraphicsContext::GetPartialTextExtents(const wxString& text, wxArr widths.Empty(); widths.Add(0, text.length()); + wxCHECK_RET( !m_font.IsNull(), wxT("wxMacCoreGraphicsContext::GetPartialTextExtents - no valid font set") ); + if (text.empty()) return; diff --git a/src/msw/graphics.cpp b/src/msw/graphics.cpp index e5583f4dcb..a271a0998b 100644 --- a/src/msw/graphics.cpp +++ b/src/msw/graphics.cpp @@ -1214,7 +1214,9 @@ void wxGDIPlusContext::DrawIcon( const wxIcon &icon, wxDouble x, wxDouble y, wxD void wxGDIPlusContext::DrawText( const wxString &str, wxDouble x, wxDouble y ) { - if ( m_font.IsNull() || str.IsEmpty()) + wxCHECK_RET( !m_font.IsNull(), wxT("wxGDIPlusContext::DrawText - no valid font set") ); + + if ( str.IsEmpty()) return ; wxWCharBuffer s = str.wc_str( *wxConvUI ); @@ -1225,6 +1227,8 @@ void wxGDIPlusContext::DrawText( const wxString &str, wxDouble x, wxDouble y ) void wxGDIPlusContext::GetTextExtent( const wxString &str, wxDouble *width, wxDouble *height, wxDouble *descent, wxDouble *externalLeading ) const { + wxCHECK_RET( !m_font.IsNull(), wxT("wxGDIPlusContext::GetTextExtent - no valid font set") ); + wxWCharBuffer s = str.wc_str( *wxConvUI ); FontFamily ffamily ; Font* f = ((wxGDIPlusFontData*)m_font.GetRefData())->GetGDIPlusFont(); @@ -1270,6 +1274,8 @@ void wxGDIPlusContext::GetPartialTextExtents(const wxString& text, wxArrayDouble widths.Empty(); widths.Add(0, text.length()); + wxCHECK_RET( !m_font.IsNull(), wxT("wxGDIPlusContext::GetPartialTextExtents - no valid font set") ); + if (text.empty()) return;