X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1dbeee57744224e5916ddac05ddce924228bce2a..8ae4f08661d7b324d5cd7aa16ab1a7b2810d94f2:/src/gtk1/dcclient.cpp diff --git a/src/gtk1/dcclient.cpp b/src/gtk1/dcclient.cpp index ef602b5ea8..9372246ca3 100644 --- a/src/gtk1/dcclient.cpp +++ b/src/gtk1/dcclient.cpp @@ -1473,6 +1473,8 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y ) const wxCharBuffer data = wxConvUTF8.cWC2MB( text ); #else const wxWCharBuffer wdata = wxConvLocal.cMB2WC( text ); + if ( !wdata ) + return; const wxCharBuffer data = wxConvUTF8.cWC2MB( wdata ); #endif size_t datalen = strlen((const char*)data); @@ -1714,7 +1716,11 @@ void wxWindowDC::DoGetTextExtent(const wxString &string, #else const wxWCharBuffer wdata = wxConvLocal.cMB2WC( string ); if ( !wdata ) + { + if (width) (*width) = 0; + if (height) (*height) = 0; return; + } const wxCharBuffer data = wxConvUTF8.cWC2MB( wdata ); const char *dataUTF8 = (const char *)data; #endif @@ -1736,8 +1742,10 @@ void wxWindowDC::DoGetTextExtent(const wxString &string, *height = (wxCoord) h; if (descent) { - // Do something about metrics here. TODO. - *descent = 0; + PangoLayoutIter *iter = pango_layout_get_iter(m_layout); + int baseline = pango_layout_iter_get_baseline(iter); + pango_layout_iter_free(iter); + *descent = h - PANGO_PIXELS(baseline); } if (externalLeading) *externalLeading = 0; // ??