Return descent from Cairo GetTextExtent() even for empty strings

This method still needs to return the correct descent in this case.

Fixes MeasuringTextTestCase::LeadingAndDescent() unit test failure with
GTK+ 3.
This commit is contained in:
Vadim Zeitlin 2017-11-07 16:26:12 +01:00
parent 643071fc77
commit 3b76e590d4

View File

@ -2644,7 +2644,10 @@ void wxCairoContext::GetTextExtent( const wxString &str, wxDouble *width, wxDoub
if ( externalLeading )
*externalLeading = 0;
if ( str.empty())
// We can skip computing the string width and height if it is empty, but
// not its descent and/or external leading, which still needs to be
// returned even for an empty string.
if ( str.empty() && !descent && !externalLeading )
return;
if ( ((wxCairoFontData*)m_font.GetRefData())->Apply((wxCairoContext*)this) )