X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1641cb376d295763dcc8bddfc01c8cca0e585332..5778dedc92f6d31435aa1cda6846979a0e9ad35b:/src/msw/dc.cpp diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp index 54b5e781fa..675447fe3a 100644 --- a/src/msw/dc.cpp +++ b/src/msw/dc.cpp @@ -1772,17 +1772,21 @@ void wxMSWDCImpl::DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y } #endif // !defined(_WIN32_WCE) || (_WIN32_WCE >= 400) - TEXTMETRIC tm; - ::GetTextMetrics(GetHdc(), &tm); - if (x) *x = sizeRect.cx; if (y) *y = sizeRect.cy; - if (descent) - *descent = tm.tmDescent; - if (externalLeading) - *externalLeading = tm.tmExternalLeading; + + if ( descent || externalLeading ) + { + TEXTMETRIC tm; + ::GetTextMetrics(GetHdc(), &tm); + + if (descent) + *descent = tm.tmDescent; + if (externalLeading) + *externalLeading = tm.tmExternalLeading; + } if ( hfontOld ) {