diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp
index a410708cebcef11262cee83f70468200115a0b9b..792e79df195a70d331555c4786220cdde293d97c 100644
--- a/src/plugins/platforms/windows/qwindowsfontengine.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp
@@ -1095,7 +1095,7 @@ QWindowsNativeImage *QWindowsFontEngine::drawGDIGlyph(HFONT font, glyph_t glyph,
         xform.eDx = margin;
         xform.eDy = margin;
 
-        HDC hdc = CreateCompatibleDC(QWindowsContext::instance()->displayContext());
+        const HDC hdc = m_fontEngineData->hdc;
 
         SetGraphicsMode(hdc, GM_ADVANCED);
         SetWorldTransform(hdc, &xform);
@@ -1107,8 +1107,16 @@ QWindowsNativeImage *QWindowsFontEngine::drawGDIGlyph(HFONT font, glyph_t glyph,
         memset(&mat, 0, sizeof(mat));
         mat.eM11.value = mat.eM22.value = 1;
 
-        if (GetGlyphOutline(hdc, glyph, ggo_options, &tgm, 0, 0, &mat) == GDI_ERROR) {
-            qWarning("QWinFontEngine: unable to query transformed glyph metrics...");
+        const DWORD result = GetGlyphOutline(hdc, glyph, ggo_options, &tgm, 0, 0, &mat);
+
+        XFORM identity = {1, 0, 0, 1, 0, 0};
+        SetWorldTransform(hdc, &identity);
+        SetGraphicsMode(hdc, GM_COMPATIBLE);
+        SelectObject(hdc, old_font);
+
+        if (result == GDI_ERROR) {
+            const int errorCode = GetLastError();
+            qErrnoWarning(errorCode, "QWinFontEngine: unable to query transformed glyph metrics (GetGlyphOutline() failed, error %d)...", errorCode);
             return 0;
         }
 
@@ -1117,10 +1125,6 @@ QWindowsNativeImage *QWindowsFontEngine::drawGDIGlyph(HFONT font, glyph_t glyph,
 
         xform.eDx -= tgm.gmptGlyphOrigin.x;
         xform.eDy += tgm.gmptGlyphOrigin.y;
-
-        SetGraphicsMode(hdc, GM_COMPATIBLE);
-        SelectObject(hdc, old_font);
-        DeleteDC(hdc);
     }
 #else // else wince
     unsigned int options = 0;