sw/source/core/text/itradj.cxx | 11 ++++------- sw/source/core/text/portxt.cxx | 3 ++- sw/source/core/txtnode/fntcache.cxx | 9 ++++++--- 3 files changed, 12 insertions(+), 11 deletions(-)
New commits: commit c45b23377bb2fe44c26f1287ff38495344e4ca50 Author: Martin Hosken <martin_hos...@sil.org> Date: Tue Nov 14 15:20:31 2017 +0700 Only do kashida insertion with fonts that have non-zero width kashidas Change-Id: I54f51432531072a8ec3cde832003369b23cb6eaf Reviewed-on: https://gerrit.libreoffice.org/44704 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Martin Hosken <martin_hos...@sil.org> diff --git a/sw/source/core/text/itradj.cxx b/sw/source/core/text/itradj.cxx index f82a3f6d1df2..29ee5e81a438 100644 --- a/sw/source/core/text/itradj.cxx +++ b/sw/source/core/text/itradj.cxx @@ -112,6 +112,9 @@ void SwTextAdjuster::FormatBlock( ) static bool lcl_CheckKashidaPositions( SwScriptInfo& rSI, SwTextSizeInfo& rInf, SwTextIter& rItr, sal_Int32& rKashidas, sal_Int32& nGluePortion ) { + if ( rInf.GetOut()->GetMinKashida() <= 0 ) + return false; + // i60594 validate Kashida justification sal_Int32 nIdx = rItr.GetStart(); sal_Int32 nEnd = rItr.GetEnd(); @@ -148,12 +151,6 @@ 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 ) ) { @@ -211,7 +208,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 ( nFontMinKashida && nKashidasInAttr > 0 && SwScriptInfo::IsArabicText( rInf.GetText(), nIdx, nNext - nIdx ) ) + if ( 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 d541607b64a0..7ffc17e970fb 100644 --- a/sw/source/core/text/portxt.cxx +++ b/sw/source/core/text/portxt.cxx @@ -112,7 +112,8 @@ static sal_Int32 lcl_AddSpace( const SwTextSizeInfo &rInf, const OUString* pStr, // Kashida Justification: Insert Kashidas if ( nEnd > nPos && pSI && COMPLEX == nScript ) { - if ( SwScriptInfo::IsArabicText( *pStr, nPos, nEnd - nPos ) && pSI->CountKashida() ) + if ( SwScriptInfo::IsArabicText( *pStr, nPos, nEnd - nPos ) && rInf.GetOut()->GetMinKashida() + && 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 6bca3c4c8a52..c7ab996bf40b 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -1248,7 +1248,8 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) // Kashida Justification if ( SwFontScript::CTL == nActual && nSpaceAdd ) { - if ( SwScriptInfo::IsArabicText( rInf.GetText(), rInf.GetIdx(), rInf.GetLen() ) ) + if ( SwScriptInfo::IsArabicText( rInf.GetText(), rInf.GetIdx(), rInf.GetLen() ) + && rInf.GetOut().GetMinKashida() ) { if ( pSI && pSI->CountKashida() && pSI->KashidaJustify( pKernArray.get(), nullptr, rInf.GetIdx(), @@ -1452,7 +1453,8 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) // Kashida Justification if ( SwFontScript::CTL == nActual && nSpaceAdd ) { - if ( SwScriptInfo::IsArabicText( rInf.GetText(), rInf.GetIdx(), rInf.GetLen() ) ) + if ( SwScriptInfo::IsArabicText( rInf.GetText(), rInf.GetIdx(), rInf.GetLen() ) + && rInf.GetOut().GetMinKashida() ) { if ( pSI && pSI->CountKashida() && pSI->KashidaJustify( pKernArray.get(), pScrArray.get(), rInf.GetIdx(), @@ -2045,7 +2047,8 @@ sal_Int32 SwFntObj::GetCursorOfst( SwDrawTextInfo &rInf ) // Kashida Justification if ( SwFontScript::CTL == nActual && rInf.GetSpace() ) { - if ( SwScriptInfo::IsArabicText( rInf.GetText(), rInf.GetIdx(), rInf.GetLen() ) ) + if ( SwScriptInfo::IsArabicText( rInf.GetText(), rInf.GetIdx(), rInf.GetLen() ) + && rInf.GetOut().GetMinKashida() ) { 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