vcl/win/gdi/salfont.cxx | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-)
New commits: commit f0653d01e15ed9f0e0e862a0679ae6ac88a2cb07 Author: Mark Hung <mark...@gmail.com> AuthorDate: Wed May 5 21:53:41 2021 +0800 Commit: Mark Hung <mark...@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 <mark...@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; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits