include/vcl/outdev.hxx | 2 +- vcl/source/outdev/textline.cxx | 21 ++++++++++----------- 2 files changed, 11 insertions(+), 12 deletions(-)
New commits: commit c026addda09086f04eca26b6da6ea72085cec518 Author: خالد حسني <kha...@libreoffice.org> AuthorDate: Thu Jun 8 15:22:58 2023 +0200 Commit: خالد حسني <kha...@libreoffice.org> CommitDate: Sat Jun 10 15:53:11 2023 +0200 Revert "tdf#151968: Fix vertical position of RTL spelling wavy line" This reverts commit 5899b27e71430e490c2d3a6b87ae52c10f383ba7. Reason for revert: tdf#155001 Change-Id: I95d21689a50f6413a7b5c126d6eb6b2c8802fbc2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152754 Tested-by: Jenkins Reviewed-by: خالد حسني <kha...@libreoffice.org> diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 4075f28abf99..d550ecfce293 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -758,7 +758,7 @@ private: SAL_DLLPRIVATE void ImplDrawPolyPolygonWithB2DPolyPolygon(const basegfx::B2DPolyPolygon& rB2DPolyPoly); ///@} - SAL_DLLPRIVATE void ImplDrawWaveLineBezier(tools::Long nStartX, tools::Long nStartY, tools::Long nEndX, tools::Long nEndY, tools::Long nWaveHeight, Degree10 nOrientation, tools::Long nLineWidth); + SAL_DLLPRIVATE void ImplDrawWaveLineBezier(tools::Long nStartX, tools::Long nStartY, tools::Long nEndX, tools::Long nEndY, tools::Long nWaveHeight, double fOrientation, tools::Long nLineWidth); /** @name Curved shape functions diff --git a/vcl/source/outdev/textline.cxx b/vcl/source/outdev/textline.cxx index d539f4fc77ca..84afc56a6cef 100644 --- a/vcl/source/outdev/textline.cxx +++ b/vcl/source/outdev/textline.cxx @@ -1012,13 +1012,14 @@ void OutputDevice::DrawWaveLine(const Point& rStartPos, const Point& rEndPos, to tools::Long nStartY = aStartPt.Y(); tools::Long nEndX = aEndPt.X(); tools::Long nEndY = aEndPt.Y(); - auto nOrientation = mpFontInstance->mnOrientation; + double fOrientation = 0.0; // handle rotation - if (nOrientation) + if (nStartY != nEndY || nStartX > nEndX) { + fOrientation = basegfx::rad2deg(std::atan2(nStartY - nEndY, nEndX - nStartX)); // un-rotate the end point - aStartPt.RotateAround(nEndX, nEndY, nOrientation); + aStartPt.RotateAround(nEndX, nEndY, Degree10(static_cast<sal_Int16>(-fOrientation * 10.0))); } // Handle HiDPI @@ -1045,9 +1046,7 @@ void OutputDevice::DrawWaveLine(const Point& rStartPos, const Point& rEndPos, to nLineWidth = 0; } - // The code below does not work for RTL text, that is what nEndX > nStartX - // check is for. - if ( nOrientation == 0_deg10 && nEndX > nStartX ) + if ( fOrientation == 0.0 ) { static vcl::DeleteOnDeinit< WavyLineCache > snLineCache {}; if ( !snLineCache.get() ) @@ -1065,7 +1064,7 @@ void OutputDevice::DrawWaveLine(const Point& rStartPos, const Point& rEndPos, to pVirtDev->SetBackground( Wallpaper( COL_TRANSPARENT ) ); pVirtDev->Erase(); pVirtDev->SetAntialiasing( AntialiasingFlags::Enable ); - pVirtDev->ImplDrawWaveLineBezier( 0, 0, nWordLength, 0, nWaveHeight, nOrientation, nLineWidth ); + pVirtDev->ImplDrawWaveLineBezier( 0, 0, nWordLength, 0, nWaveHeight, fOrientation, nLineWidth ); BitmapEx aBitmapEx(pVirtDev->GetBitmapEx(Point(0, 0), pVirtDev->GetOutputSize())); // Ideally we don't need this block, but in the split rgb surface + separate alpha surface @@ -1086,10 +1085,10 @@ void OutputDevice::DrawWaveLine(const Point& rStartPos, const Point& rEndPos, to return; } - ImplDrawWaveLineBezier( nStartX, nStartY, nEndX, nEndY, nWaveHeight, nOrientation, nLineWidth ); + ImplDrawWaveLineBezier( nStartX, nStartY, nEndX, nEndY, nWaveHeight, fOrientation, nLineWidth ); } -void OutputDevice::ImplDrawWaveLineBezier(tools::Long nStartX, tools::Long nStartY, tools::Long nEndX, tools::Long nEndY, tools::Long nWaveHeight, Degree10 nOrientation, tools::Long nLineWidth) +void OutputDevice::ImplDrawWaveLineBezier(tools::Long nStartX, tools::Long nStartY, tools::Long nEndX, tools::Long nEndY, tools::Long nWaveHeight, double fOrientation, tools::Long nLineWidth) { // we need a graphics if( !mpGraphics && !AcquireGraphics() ) @@ -1107,7 +1106,7 @@ void OutputDevice::ImplDrawWaveLineBezier(tools::Long nStartX, tools::Long nStar const basegfx::B2DRectangle aWaveLineRectangle(nStartX, nStartY, nEndX, nEndY + nWaveHeight); const basegfx::B2DPolygon aWaveLinePolygon = basegfx::createWaveLinePolygon(aWaveLineRectangle); - const basegfx::B2DHomMatrix aRotationMatrix = basegfx::utils::createRotateAroundPoint(nStartX, nStartY, toRadians(nOrientation)); + const basegfx::B2DHomMatrix aRotationMatrix = basegfx::utils::createRotateAroundPoint(nStartX, nStartY, basegfx::deg2rad(-fOrientation)); const bool bPixelSnapHairline(mnAntialiasing & AntialiasingFlags::PixelSnapHairline); mpGraphics->SetLineColor(GetLineColor()); @@ -1124,7 +1123,7 @@ void OutputDevice::ImplDrawWaveLineBezier(tools::Long nStartX, tools::Long nStar *this); if( mpAlphaVDev ) - mpAlphaVDev->ImplDrawWaveLineBezier(nStartX, nStartY, nEndX, nEndY, nWaveHeight, nOrientation, nLineWidth); + mpAlphaVDev->ImplDrawWaveLineBezier(nStartX, nStartY, nEndX, nEndY, nWaveHeight, fOrientation, nLineWidth); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */