sw/source/core/text/itradj.cxx | 11 +++++++---- sw/source/core/text/portxt.cxx | 3 +-- sw/source/core/txtnode/fntcache.cxx | 9 +++------ 3 files changed, 11 insertions(+), 12 deletions(-)
New commits: commit 76848756909cb969b4689ebd2dd3b5fa27b0dc23 Author: Khaled Hosny <khaledho...@eglug.org> AuthorDate: Thu Mar 21 15:00:22 2019 +0200 Commit: Xisco Faulí <xiscofa...@libreoffice.org> CommitDate: Fri Mar 22 10:02:18 2019 +0100 tdf#124109: Revert "Only do kashida insertion with fonts that have non-zero width kashidas" This reverts commit c45b23377bb2fe44c26f1287ff38495344e4ca50. This commit breaks Kashida justification when a document is first opened (the kashida justification will be disabled and spaces will be used untill the text is changed). Probably it is checking for width of Kashida glyph too early. Also I'm not sure what the reverted commit was trying to fix since we already do kashida justification in fonts that has non-zero width Kashida and it has been the case for a long time. This does not fix the original issue in the document attched with the bug report, but if fixes kashida not being applied when opening the document. Change-Id: Ic95859bca94fa792793e3223d2adb465bc6d880f Reviewed-on: https://gerrit.libreoffice.org/69509 Tested-by: Jenkins Reviewed-by: Xisco Faulí <xiscofa...@libreoffice.org> (cherry picked from commit 0a8e9cc5c1782f1cd50ef338ec2aa4f6776a4c0e) Reviewed-on: https://gerrit.libreoffice.org/69518 Reviewed-by: Khaled Hosny <khaledho...@eglug.org> diff --git a/sw/source/core/text/itradj.cxx b/sw/source/core/text/itradj.cxx index b4fca7913754..9fa38426f2b2 100644 --- a/sw/source/core/text/itradj.cxx +++ b/sw/source/core/text/itradj.cxx @@ -114,9 +114,6 @@ void SwTextAdjuster::FormatBlock( ) static bool lcl_CheckKashidaPositions( SwScriptInfo& rSI, SwTextSizeInfo& rInf, SwTextIter& rItr, sal_Int32& rKashidas, TextFrameIndex& nGluePortion) { - if ( rInf.GetOut()->GetMinKashida() <= 0 ) - return false; - // i60594 validate Kashida justification TextFrameIndex nIdx = rItr.GetStart(); TextFrameIndex nEnd = rItr.GetEnd(); @@ -154,6 +151,12 @@ static bool lcl_CheckKashidaPositions( SwScriptInfo& rSI, SwTextSizeInfo& rInf, sal_Int32 nKashidasInAttr = rSI.KashidaJustify ( nullptr, nullptr, nIdx, nNext - nIdx ); if (nKashidasInAttr > 0) { + // Kashida glyph looks suspicious, skip Kashida justification + if ( rInf.GetOut()->GetMinKashida() <= 0 ) + { + return false; + } + sal_Int32 nKashidasDropped = 0; if ( !SwScriptInfo::IsArabicText( rInf.GetText(), nIdx, nNext - nIdx ) ) { @@ -213,7 +216,7 @@ static bool lcl_CheckKashidaWidth ( SwScriptInfo& rSI, SwTextSizeInfo& rInf, SwT sal_Int32 nKashidasInAttr = rSI.KashidaJustify ( nullptr, nullptr, nIdx, nNext - nIdx ); long nFontMinKashida = rInf.GetOut()->GetMinKashida(); - if ( nKashidasInAttr > 0 && SwScriptInfo::IsArabicText( rInf.GetText(), nIdx, nNext - nIdx ) ) + if ( nFontMinKashida && nKashidasInAttr > 0 && SwScriptInfo::IsArabicText( rInf.GetText(), nIdx, nNext - nIdx ) ) { sal_Int32 nKashidasDropped = 0; while ( rKashidas && nGluePortion && nKashidasInAttr > 0 && diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx index 73bf691adfa1..4a96dc57becf 100644 --- a/sw/source/core/text/portxt.cxx +++ b/sw/source/core/text/portxt.cxx @@ -115,8 +115,7 @@ static TextFrameIndex lcl_AddSpace(const SwTextSizeInfo &rInf, // Kashida Justification: Insert Kashidas if ( nEnd > nPos && pSI && COMPLEX == nScript ) { - if ( SwScriptInfo::IsArabicText( *pStr, nPos, nEnd - nPos ) && rInf.GetOut()->GetMinKashida() - && pSI->CountKashida() ) + if ( SwScriptInfo::IsArabicText( *pStr, nPos, nEnd - nPos ) && pSI->CountKashida() ) { const sal_Int32 nKashRes = pSI->KashidaJustify( nullptr, nullptr, nPos, nEnd - nPos ); // i60591: need to check result of KashidaJustify diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index 24d91cba54f0..55278e70011c 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -1314,8 +1314,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) // Kashida Justification if ( SwFontScript::CTL == nActual && nSpaceAdd ) { - if ( SwScriptInfo::IsArabicText( rInf.GetText(), rInf.GetIdx(), rInf.GetLen() ) - && rInf.GetOut().GetMinKashida() ) + if ( SwScriptInfo::IsArabicText( rInf.GetText(), rInf.GetIdx(), rInf.GetLen() ) ) { if ( pSI && pSI->CountKashida() && pSI->KashidaJustify( pKernArray.get(), nullptr, rInf.GetIdx(), @@ -1525,8 +1524,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) // Kashida Justification if ( SwFontScript::CTL == nActual && nSpaceAdd ) { - if ( SwScriptInfo::IsArabicText( rInf.GetText(), rInf.GetIdx(), rInf.GetLen() ) - && rInf.GetOut().GetMinKashida() ) + if ( SwScriptInfo::IsArabicText( rInf.GetText(), rInf.GetIdx(), rInf.GetLen() ) ) { if ( pSI && pSI->CountKashida() && pSI->KashidaJustify( pKernArray.get(), pScrArray.get(), rInf.GetIdx(), @@ -2127,8 +2125,7 @@ TextFrameIndex SwFntObj::GetCursorOfst(SwDrawTextInfo &rInf) // Kashida Justification if ( SwFontScript::CTL == nActual && rInf.GetSpace() ) { - if ( SwScriptInfo::IsArabicText( rInf.GetText(), rInf.GetIdx(), rInf.GetLen() ) - && rInf.GetOut().GetMinKashida() ) + if ( SwScriptInfo::IsArabicText( rInf.GetText(), rInf.GetIdx(), rInf.GetLen() ) ) { if ( pSI && pSI->CountKashida() && pSI->KashidaJustify( pKernArray.get(), nullptr, rInf.GetIdx(), rInf.GetLen(), _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits