guarding all text methods against unset font
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54919 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1400,7 +1400,9 @@ void wxCairoContext::DrawIcon( const wxIcon &icon, wxDouble x, wxDouble y, wxDou
|
|||||||
|
|
||||||
void wxCairoContext::DrawText( const wxString &str, wxDouble x, wxDouble y )
|
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;
|
return;
|
||||||
|
|
||||||
#ifdef __WXGTK__
|
#ifdef __WXGTK__
|
||||||
@@ -1433,6 +1435,8 @@ void wxCairoContext::DrawText( const wxString &str, wxDouble x, wxDouble y )
|
|||||||
void wxCairoContext::GetTextExtent( const wxString &str, wxDouble *width, wxDouble *height,
|
void wxCairoContext::GetTextExtent( const wxString &str, wxDouble *width, wxDouble *height,
|
||||||
wxDouble *descent, wxDouble *externalLeading ) const
|
wxDouble *descent, wxDouble *externalLeading ) const
|
||||||
{
|
{
|
||||||
|
wxCHECK_RET( !m_font.IsNull(), wxT("wxCairoContext::GetTextExtent - no valid font set") );
|
||||||
|
|
||||||
if ( width )
|
if ( width )
|
||||||
*width = 0;
|
*width = 0;
|
||||||
if ( height )
|
if ( height )
|
||||||
@@ -1442,7 +1446,7 @@ void wxCairoContext::GetTextExtent( const wxString &str, wxDouble *width, wxDoub
|
|||||||
if ( externalLeading )
|
if ( externalLeading )
|
||||||
*externalLeading = 0;
|
*externalLeading = 0;
|
||||||
|
|
||||||
if ( m_font.IsNull() || str.empty())
|
if ( str.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef __WXGTK__
|
#ifdef __WXGTK__
|
||||||
@@ -1511,6 +1515,8 @@ void wxCairoContext::GetPartialTextExtents(const wxString& text, wxArrayDouble&
|
|||||||
widths.Empty();
|
widths.Empty();
|
||||||
widths.Add(0, text.length());
|
widths.Add(0, text.length());
|
||||||
|
|
||||||
|
wxCHECK_RET( !m_font.IsNull(), wxT("wxCairoContext::GetPartialTextExtents - no valid font set") );
|
||||||
|
|
||||||
if (text.empty())
|
if (text.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@@ -1261,7 +1261,9 @@ void wxGDIPlusContext::DrawIcon( const wxIcon &icon, wxDouble x, wxDouble y, wxD
|
|||||||
|
|
||||||
void wxGDIPlusContext::DrawText( const wxString &str, wxDouble x, wxDouble y )
|
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 ;
|
return ;
|
||||||
|
|
||||||
wxWCharBuffer s = str.wc_str( *wxConvUI );
|
wxWCharBuffer s = str.wc_str( *wxConvUI );
|
||||||
@@ -1272,6 +1274,8 @@ void wxGDIPlusContext::DrawText( const wxString &str, wxDouble x, wxDouble y )
|
|||||||
void wxGDIPlusContext::GetTextExtent( const wxString &str, wxDouble *width, wxDouble *height,
|
void wxGDIPlusContext::GetTextExtent( const wxString &str, wxDouble *width, wxDouble *height,
|
||||||
wxDouble *descent, wxDouble *externalLeading ) const
|
wxDouble *descent, wxDouble *externalLeading ) const
|
||||||
{
|
{
|
||||||
|
wxCHECK_RET( !m_font.IsNull(), wxT("wxGDIPlusContext::GetTextExtent - no valid font set") );
|
||||||
|
|
||||||
wxWCharBuffer s = str.wc_str( *wxConvUI );
|
wxWCharBuffer s = str.wc_str( *wxConvUI );
|
||||||
FontFamily ffamily ;
|
FontFamily ffamily ;
|
||||||
Font* f = ((wxGDIPlusFontData*)m_font.GetRefData())->GetGDIPlusFont();
|
Font* f = ((wxGDIPlusFontData*)m_font.GetRefData())->GetGDIPlusFont();
|
||||||
@@ -1317,6 +1321,8 @@ void wxGDIPlusContext::GetPartialTextExtents(const wxString& text, wxArrayDouble
|
|||||||
widths.Empty();
|
widths.Empty();
|
||||||
widths.Add(0, text.length());
|
widths.Add(0, text.length());
|
||||||
|
|
||||||
|
wxCHECK_RET( !m_font.IsNull(), wxT("wxGDIPlusContext::GetPartialTextExtents - no valid font set") );
|
||||||
|
|
||||||
if (text.empty())
|
if (text.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@@ -1941,8 +1941,7 @@ void wxMacCoreGraphicsContext::PopState()
|
|||||||
|
|
||||||
void wxMacCoreGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDouble y )
|
void wxMacCoreGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDouble y )
|
||||||
{
|
{
|
||||||
if ( m_font.IsNull() )
|
wxCHECK_RET( !m_font.IsNull(), wxT("wxMacCoreGraphicsContext::DrawText - no valid font set") );
|
||||||
return;
|
|
||||||
|
|
||||||
EnsureIsValid();
|
EnsureIsValid();
|
||||||
#if wxOSX_USE_CORE_TEXT
|
#if wxOSX_USE_CORE_TEXT
|
||||||
@@ -1998,8 +1997,7 @@ void wxMacCoreGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDoub
|
|||||||
|
|
||||||
void wxMacCoreGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDouble y, wxDouble angle )
|
void wxMacCoreGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDouble y, wxDouble angle )
|
||||||
{
|
{
|
||||||
if ( m_font.IsNull() )
|
wxCHECK_RET( !m_font.IsNull(), wxT("wxMacCoreGraphicsContext::DrawText - no valid font set") );
|
||||||
return;
|
|
||||||
|
|
||||||
EnsureIsValid();
|
EnsureIsValid();
|
||||||
#if wxOSX_USE_CORE_TEXT
|
#if wxOSX_USE_CORE_TEXT
|
||||||
@@ -2103,7 +2101,7 @@ void wxMacCoreGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDoub
|
|||||||
void wxMacCoreGraphicsContext::GetTextExtent( const wxString &str, wxDouble *width, wxDouble *height,
|
void wxMacCoreGraphicsContext::GetTextExtent( const wxString &str, wxDouble *width, wxDouble *height,
|
||||||
wxDouble *descent, wxDouble *externalLeading ) const
|
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 )
|
if ( width )
|
||||||
*width = 0;
|
*width = 0;
|
||||||
@@ -2207,6 +2205,8 @@ void wxMacCoreGraphicsContext::GetPartialTextExtents(const wxString& text, wxArr
|
|||||||
widths.Empty();
|
widths.Empty();
|
||||||
widths.Add(0, text.length());
|
widths.Add(0, text.length());
|
||||||
|
|
||||||
|
wxCHECK_RET( !m_font.IsNull(), wxT("wxMacCoreGraphicsContext::DrawText - no valid font set") );
|
||||||
|
|
||||||
if (text.empty())
|
if (text.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user