summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@centrum.cz>2021-04-20 09:48:25 +0000
committerLuboš Luňák <l.lunak@collabora.com>2021-04-20 14:13:47 +0200
commit764360df78535befcc4806736fcbaedbe0e34ea1 (patch)
treefdfea0dc9e153adeca91991050a176bef2476539 /vcl
parentb08a2b299418db84a71fe625f127f0484746010e (diff)
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>
Diffstat (limited to 'vcl')
-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 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;
}