[Libreoffice-commits] core.git: vcl/skia

Luboš Luňák (via logerrit) logerrit at kemper.freedesktop.org
Thu Mar 4 19:24:25 UTC 2021


 vcl/skia/win/gdiimpl.cxx |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 0087dc55121808a7fbf09cd94549b44dc17707dd
Author:     Luboš Luňák <l.lunak at centrum.cz>
AuthorDate: Thu Mar 4 16:40:19 2021 +0000
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Thu Mar 4 20:23:45 2021 +0100

    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 at collabora.com>

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;


More information about the Libreoffice-commits mailing list