]> git.saurik.com Git - wxWidgets.git/commitdiff
do use the font in DoGetTextExtent()
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 18 May 2007 15:21:47 +0000 (15:21 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 18 May 2007 15:21:47 +0000 (15:21 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46105 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/metafile.cpp

index 29c08d30f2aa5b71c3bb98bcb727baa7aac1ee1d..2186f3ef18e5d9573aea35645638bdc04b12380f 100644 (file)
@@ -218,14 +218,13 @@ void wxMetafileDC::DoGetTextExtent(const wxString& string,
     if (!fontToUse)
         fontToUse = &m_font;
 
-    HDC dc = GetDC(NULL);
+    ScreenHDC dc;
+    SelectInHDC selFont(dc, GetHfontOf(*fontToUse));
 
     SIZE sizeRect;
     TEXTMETRIC tm;
     ::GetTextExtentPoint32(dc, WXSTRINGCAST string, wxStrlen(WXSTRINGCAST string), &sizeRect);
-    GetTextMetrics(dc, &tm);
-
-    ReleaseDC(NULL, dc);
+    ::GetTextMetrics(dc, &tm);
 
     if ( x )
         *x = sizeRect.cx;