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

Luboš Luňák (via logerrit) logerrit at kemper.freedesktop.org
Tue Apr 20 12:14:51 UTC 2021


 vcl/skia/win/gdiimpl.cxx |    6 ++++++
 1 file changed, 6 insertions(+)

New commits:
commit 764360df78535befcc4806736fcbaedbe0e34ea1
Author:     Luboš Luňák <l.lunak at centrum.cz>
AuthorDate: Tue Apr 20 09:48:25 2021 +0000
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Tue Apr 20 14:13:47 2021 +0200

    fix too wide glyphs with Skia/GDI if horizontal scale is used (tdf#141715)
    
    Change-Id: I7b06b64e04313493f48b7224fbc4883356feda95
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114327
    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 94162bb55fbe..5f7e1fe3538a 100644
--- a/vcl/skia/win/gdiimpl.cxx
+++ b/vcl/skia/win/gdiimpl.cxx
@@ -216,6 +216,12 @@ bool WinSkiaSalGraphicsImpl::DrawTextLayout(const GenericSalLayout& rLayout)
         bool dwrite = true;
         if (!typeface) // fall back to GDI text rendering
         {
+            // If lfWidth is kept, then with fHScale != 1 characters get too wide, presumably
+            // because the horizontal scaling gets applied twice if GDI is used for drawing (tdf#141715).
+            // Using lfWidth /= fHScale gives slightly incorrect sizes, for a reason I don't understand.
+            // LOGFONT docs say that 0 means GDI will find out the right value on its own somehow,
+            // and it apparently works.
+            logFont.lfWidth = 0;
             typeface.reset(SkCreateTypefaceFromLOGFONT(logFont));
             dwrite = false;
         }


More information about the Libreoffice-commits mailing list