X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e0da9e871a3184daa1a32bcacbfdf6ddb9ed7db4..f7f8a13c0466725ffffc0cbe9f10da729c3423dd:/src/gtk/textmeasure.cpp?ds=sidebyside diff --git a/src/gtk/textmeasure.cpp b/src/gtk/textmeasure.cpp index 7320111f0e..407a62f36b 100644 --- a/src/gtk/textmeasure.cpp +++ b/src/gtk/textmeasure.cpp @@ -3,7 +3,6 @@ // Purpose: wxTextMeasure implementation for wxGTK // Author: Manuel Martin // Created: 2012-10-05 -// RCS-ID: $Id: // Copyright: (c) 1997-2012 wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -116,14 +115,17 @@ void wxTextMeasure::DoGetTextExtent(const wxString& string, { if ( !m_context ) { - *width = - *height = 0; + if ( width ) + *width = 0; + + if ( height ) + *height = 0; return; } // Set layout's text const wxCharBuffer dataUTF8 = wxGTK_CONV_FONT(string, GetFont()); - if ( !dataUTF8 ) + if ( !dataUTF8 && !string.empty() ) { // hardly ideal, but what else can we do if conversion failed? wxLogLastError(wxT("GetTextExtent")); @@ -162,8 +164,11 @@ void wxTextMeasure::DoGetTextExtent(const wxString& string, bool wxTextMeasure::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths, - double WXUNUSED(scaleX)) + double scaleX) { + if ( !m_layout ) + return wxTextMeasureBase::DoGetPartialTextExtents(text, widths, scaleX); + // Set layout's text const wxCharBuffer dataUTF8 = wxGTK_CONV_FONT(text, GetFont()); if ( !dataUTF8 )