[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sw/source

Martin Hosken martin_hosken at sil.org
Tue Nov 14 18:08:34 UTC 2017


 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 0a03336a68701f592f563538f70bb3465808c644
Author: Martin Hosken <martin_hosken at 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/44723
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Martin Hosken <martin_hosken at sil.org>

diff --git a/sw/source/core/text/itradj.cxx b/sw/source/core/text/itradj.cxx
index 08c6938028b3..0c39304900ac 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 bcdd4772cd31..da605c53de7f 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 8617a3b80db4..f7b055bccb65 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -1254,7 +1254,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(),
@@ -1458,7 +1459,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(),
@@ -2051,7 +2053,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(),


More information about the Libreoffice-commits mailing list