summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@centrum.cz>2021-04-20 09:48:25 +0000
committerMichael Stahl <michael.stahl@allotropia.de>2021-04-22 11:05:12 +0200
commitb40e3555d7dc2a18c2fce1387d179bcdfc897d24 (patch)
treec517ee9892b157c0a7e6986a7f6f48e17d1f994c
parentResolves: tdf#141770 remove empty tag (diff)
downloadcore-b40e3555d7dc2a18c2fce1387d179bcdfc897d24.tar.gz
core-b40e3555d7dc2a18c2fce1387d179bcdfc897d24.zip
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@collabora.com> (cherry picked from commit 764360df78535befcc4806736fcbaedbe0e34ea1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114285 Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com> Reviewed-by: V, Stuart Foote <vstuart.foote@utsa.edu> Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Tested-by: Michael Stahl <michael.stahl@allotropia.de>
-rw-r--r--vcl/skia/win/gdiimpl.cxx6
1 files changed, 6 insertions, 0 deletions
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;
}