summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@centrum.cz>2021-03-04 16:40:19 +0000
committerCaolán McNamara <caolanm@redhat.com>2021-03-05 14:52:00 +0100
commit36b1c3a5a886c0d30a8347422b14d2eb3b98a32e (patch)
tree682a9b929af9c8ff4b1f590a3b1718c85d997eec
parentdb5b95ada67fece82e68871e5eff0c028afd8d9c (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> (cherry picked from commit 0087dc55121808a7fbf09cd94549b44dc17707dd) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111927
-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;