fix Skia glyph orientation with DirectWrite (tdf#132084)
LOGFONT includes info about whether a glyph should be rotated, so
we don't need to do it explicitly, but with DirectWrite apparently
this information doesn't carry over.
Change-Id: I4530511c4de7b64a6488629b380be34d4a42b3d2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92260
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
diff --git a/vcl/skia/win/gdiimpl.cxx b/vcl/skia/win/gdiimpl.cxx
index fd79679..2de81c7 100644
--- a/vcl/skia/win/gdiimpl.cxx
+++ b/vcl/skia/win/gdiimpl.cxx
@@ -172,8 +172,12 @@
return false;
}
sk_sp<SkTypeface> typeface = createDirectWriteTypeface(logFont);
GlyphOrientation glyphOrientation = GlyphOrientation::Apply;
if (!typeface) // fall back to GDI text rendering
{
typeface.reset(SkCreateTypefaceFromLOGFONT(logFont));
glyphOrientation = GlyphOrientation::Ignore;
}
// lfHeight actually depends on DPI, so it's not really font height as such,
// but for LOGFONT-based typefaces Skia simply sets lfHeight back to this value
// directly.
@@ -187,7 +191,7 @@
COLORREF color = ::GetTextColor(mWinParent.getHDC());
Color salColor(GetRValue(color), GetGValue(color), GetBValue(color));
// The font already is set up to have glyphs rotated as needed.
impl->drawGenericLayout(rLayout, salColor, font, SkiaSalGraphicsImpl::GlyphOrientation::Ignore);
impl->drawGenericLayout(rLayout, salColor, font, glyphOrientation);
return true;
}