summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@centrum.cz>2021-03-04 16:40:19 +0000
committerLuboš Luňák <l.lunak@collabora.com>2021-03-04 20:23:45 +0100
commit0087dc55121808a7fbf09cd94549b44dc17707dd (patch)
treeb9b60fd1ddf24c8e99f7d1be5b7732ae2e349781
parent5e0f1a674c1fa6aa61ebbb0213c1bfb71194b59b (diff)
actually restore the original HFONT
A mistake I made when fixing tdf#137122. Change-Id: Ie3a258de69e17d8cedb3bf722841af1054bd0fe1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111972 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
-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 9381693213b1..6b09375c4138 100644
--- a/vcl/skia/win/gdiimpl.cxx
+++ b/vcl/skia/win/gdiimpl.cxx
@@ -176,10 +176,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;