svx/source/svdraw/svdotextdecomposition.cxx | 8 ++++++-- sw/source/core/txtnode/fntcache.cxx | 10 ++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-)
New commits: commit 74b6c5ea3c333de7c5e7ef8636732edadd9083f2 Author: Khaled Hosny <kha...@libreoffice.org> AuthorDate: Thu Jun 8 16:41:18 2023 +0300 Commit: خالد حسني <kha...@libreoffice.org> CommitDate: Sat Jun 10 19:05:13 2023 +0200 tdf#151968: Fix vertical position of RTL spelling wavy line Second try. This time making sure start > end even for RTL text. This also now works for horizontal, vertical and rotated Arabic text, in Writer and Edit Engine. Change-Id: I6fe1e9dbb9c071287054200a58d4ddddee073311 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152743 Tested-by: Jenkins Reviewed-by: خالد حسني <kha...@libreoffice.org> diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx index 138b709e9769..726ee850eb8b 100644 --- a/svx/source/svdraw/svdotextdecomposition.cxx +++ b/svx/source/svdraw/svdotextdecomposition.cxx @@ -427,8 +427,12 @@ namespace // full portion width const double fTextWidth(aDXArray[aDXArray.size() - 1]); - fStart = fTextWidth - fStart; - fEnd = fTextWidth - fEnd; + // tdf#151968 + // if start < end, OutputDevice::DrawWaveLine() will + // think it is a rotated line, so we swap fStart and + // fEnd to avoid this. + fStart = fTextWidth - fEnd; + fEnd = fTextWidth - fStart; } // need to take FontScaling out of values; it's already part of diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index e125906767f6..bc5dd603a433 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -241,10 +241,20 @@ static void lcl_calcLinePos( const CalcLinePosData &rData, break; } + // tdf#151968 + // if start < end, OutputDevice::DrawWaveLine() will think it is a rotated + // line, so we swap nStart and nEnd to avoid this. + if ( rData.bBidiPor ) + std::swap(rStart, rEnd); + if ( rData.bSwitchL2R ) { rData.rInf.GetFrame()->SwitchLTRtoRTL( rStart ); rData.rInf.GetFrame()->SwitchLTRtoRTL( rEnd ); + + // tdf#151968 + // We need to do this here as well for LTR text in a RTL paragraph. + std::swap(rStart, rEnd); } if ( rData.bSwitchH2V )