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

New commits:
commit b40e3555d7dc2a18c2fce1387d179bcdfc897d24
Author:     Luboš Luňák <l.lu...@centrum.cz>
AuthorDate: Tue Apr 20 09:48:25 2021 +0000
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Thu Apr 22 11:05:12 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.lu...@collabora.com>
    (cherry picked from commit 764360df78535befcc4806736fcbaedbe0e34ea1)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114285
    Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>
    Reviewed-by: V, Stuart Foote <vstuart.fo...@utsa.edu>
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    Tested-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/vcl/skia/win/gdiimpl.cxx b/vcl/skia/win/gdiimpl.cxx
index b609581e1e84..d35cf91232ac 100644
--- a/vcl/skia/win/gdiimpl.cxx
+++ b/vcl/skia/win/gdiimpl.cxx
@@ -213,6 +213,12 @@ bool WinSkiaSalGraphicsImpl::DrawTextLayout(const 
GenericSalLayout& rLayout)
     GlyphOrientation glyphOrientation = GlyphOrientation::Apply;
     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));
         glyphOrientation = GlyphOrientation::Ignore;
     }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to