[Libreoffice-commits] core.git: vcl/win
Mark Hung (via logerrit)
logerrit at kemper.freedesktop.org
Sat May 8 04:37:40 UTC 2021
vcl/win/gdi/salfont.cxx | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
New commits:
commit f0653d01e15ed9f0e0e862a0679ae6ac88a2cb07
Author: Mark Hung <marklh9 at gmail.com>
AuthorDate: Wed May 5 21:53:41 2021 +0800
Commit: Mark Hung <marklh9 at gmail.com>
CommitDate: Sat May 8 06:37:05 2021 +0200
vcl: vertical writing in WinFontInstance::ImplGetGlyphBoundRect.
Identity matrix isn't enough for vertical writing. For those glyphs
that is vertical, they have to be rotated 90 degrees.
Change-Id: Ia5f1f8ac9cea89aec2c98b88058ec79f733fc238
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115148
Tested-by: Jenkins
Reviewed-by: Mark Hung <marklh9 at gmail.com>
diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 6fd4836e3040..39f67e26a057 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -1254,7 +1254,7 @@ void WinSalGraphics::ClearDevFontCache()
ImplReleaseTempFonts(*GetSalData(), false);
}
-bool WinFontInstance::ImplGetGlyphBoundRect(sal_GlyphId nId, tools::Rectangle& rRect, bool) const
+bool WinFontInstance::ImplGetGlyphBoundRect(sal_GlyphId nId, tools::Rectangle& rRect, bool bIsVertical) const
{
assert(m_pGraphics);
HDC hDC = m_pGraphics->getHDC();
@@ -1269,8 +1269,24 @@ bool WinFontInstance::ImplGetGlyphBoundRect(sal_GlyphId nId, tools::Rectangle& r
// use unity matrix
MAT2 aMat;
- aMat.eM11 = aMat.eM22 = FixedFromDouble( 1.0 );
- aMat.eM12 = aMat.eM21 = FixedFromDouble( 0.0 );
+ const FontSelectPattern& rFSD = GetFontSelectPattern();
+
+ // Use identity matrix for fonts requested in horizontal
+ // writing (LTR or RTL), or rotated glyphs in vertical writing.
+ if (!rFSD.mbVertical || !bIsVertical)
+ {
+ aMat.eM11 = aMat.eM22 = FixedFromDouble(1.0);
+ aMat.eM12 = aMat.eM21 = FixedFromDouble(0.0);
+ }
+ else
+ {
+ constexpr double nCos = 0.0;
+ constexpr double nSin = 1.0;
+ aMat.eM11 = FixedFromDouble(nCos);
+ aMat.eM12 = FixedFromDouble(nSin);
+ aMat.eM21 = FixedFromDouble(-nSin);
+ aMat.eM22 = FixedFromDouble(nCos);
+ }
UINT nGGOFlags = GGO_METRICS;
nGGOFlags |= GGO_GLYPH_INDEX;
More information about the Libreoffice-commits
mailing list