summaryrefslogtreecommitdiff
path: root/vcl/inc
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@centrum.cz>2021-02-25 10:05:36 +0000
committerCaolán McNamara <caolanm@redhat.com>2021-03-01 21:26:43 +0100
commit00e11574b19e996139d78bf7fb9c06ec1651c12d (patch)
treeaa581920773825b878c6d0b88905caa8893c3462 /vcl/inc
parent501cdc4fe3392f2d5d97b2940c012a3d0e079cbd (diff)
make sure Skia DWrite matches the given HFONT exactly (tdf#137122)
The problem appears to be that we use our private copy of the Dejavu Sans fonts, installed using AddFontResourceExW( FR_PRIVATE ), but that's not for whatever reason available for DirectWrite, which made CreateFontFromLOGFONT() find the system-installed Dejavu Sans, and if there was a difference between the two, then incorrect glyph ids were used. Use CreateFontFaceFromHdc(), which seems to match exactly. For private fonts this later fails the check with GetSystemFontCollection(), which would be nice to handle somehow, but I don't know how to get a font collection containing those fonts other than modifying SalFont to use DirectWrite API to install the fonts. Change-Id: I10d8fcb618f3b4decbb0198274331d7beaf843d6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111522 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111773 Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/inc')
-rw-r--r--vcl/inc/skia/win/gdiimpl.hxx9
1 files changed, 5 insertions, 4 deletions
diff --git a/vcl/inc/skia/win/gdiimpl.hxx b/vcl/inc/skia/win/gdiimpl.hxx
index 12d2b2c10c63..2dd67826beeb 100644
--- a/vcl/inc/skia/win/gdiimpl.hxx
+++ b/vcl/inc/skia/win/gdiimpl.hxx
@@ -11,8 +11,9 @@
#define INCLUDED_VCL_INC_SKIA_WIN_GDIIMPL_HXX
#include <memory>
-#include <vcl/dllapi.h>
+#include <systools/win32/comtools.hxx>
+#include <vcl/dllapi.h>
#include <skia/gdiimpl.hxx>
#include <win/salgdi.h>
#include <win/wingdiimpl.hxx>
@@ -75,10 +76,10 @@ public:
protected:
virtual void createWindowContext(bool forceRaster = false) override;
virtual void performFlush() override;
- sk_sp<SkTypeface> createDirectWriteTypeface(const LOGFONTW& logFont);
+ sk_sp<SkTypeface> createDirectWriteTypeface(HDC hdc, HFONT hfont);
static void initFontInfo();
- inline static IDWriteFactory* dwriteFactory;
- inline static IDWriteGdiInterop* dwriteGdiInterop;
+ inline static sal::systools::COMReference<IDWriteFactory> dwriteFactory;
+ inline static sal::systools::COMReference<IDWriteGdiInterop> dwriteGdiInterop;
inline static sk_sp<SkFontMgr> dwriteFontMgr;
inline static bool dwriteDone = false;
static SkFont::Edging fontEdging;