summaryrefslogtreecommitdiff
path: root/vcl/skia/win/gdiimpl.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/skia/win/gdiimpl.cxx')
-rw-r--r--vcl/skia/win/gdiimpl.cxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/vcl/skia/win/gdiimpl.cxx b/vcl/skia/win/gdiimpl.cxx
index e2ea31de8aaa..b609581e1e84 100644
--- a/vcl/skia/win/gdiimpl.cxx
+++ b/vcl/skia/win/gdiimpl.cxx
@@ -174,10 +174,13 @@ sk_sp<SkTypeface> WinSkiaSalGraphicsImpl::createDirectWriteTypeface(HDC hdc, HFO
// included the DWrite system font collection). For such cases, we'll
// need to fall back to Skia's GDI-based font rendering.
HFONT oldFont = SelectFont(hdc, hfont);
- auto restoreFont = [hdc, oldFont]() { SelectFont(hdc, oldFont); };
sal::systools::COMReference<IDWriteFontFace> fontFace;
if (FAILED(CHECKHR(dwriteGdiInterop->CreateFontFaceFromHdc(hdc, &fontFace))))
+ {
+ SelectFont(hdc, oldFont);
return nullptr;
+ }
+ SelectFont(hdc, oldFont);
sal::systools::COMReference<IDWriteFontCollection> collection;
if (FAILED(CHECKHR(dwriteFactory->GetSystemFontCollection(&collection))))
return nullptr;