sw/source/core/txtnode/fntcache.cxx |   27 +++++++++++++++++++--------
 1 file changed, 19 insertions(+), 8 deletions(-)

New commits:
commit 224a400f7c46548a22060659e74e33db2a02f5a0
Author:     Caolán McNamara <[email protected]>
AuthorDate: Tue Dec 21 11:55:09 2021 +0000
Commit:     Caolán McNamara <[email protected]>
CommitDate: Tue Dec 21 20:17:32 2021 +0100

    split out the block where we add extra space from the kerning adjustment 
block
    
    so the two independent things are seperated from eachother
    
    no logic change intended
    
    Change-Id: I55532b58974077286a6b062144eb4872d2c40328
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127243
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/sw/source/core/txtnode/fntcache.cxx 
b/sw/source/core/txtnode/fntcache.cxx
index 6aa92c330b8f..7fb66120e7e8 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -1699,7 +1699,25 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
                 if ( nCh == CH_BLANK )
                 {
                     nScrPos = aKernArray[i-1] + nScr;
+                }
+                else
+                {
+                    if ( cChPrev == CH_BLANK )
+                    {
+                        nScrPos = aKernArray[i-1] + nScr;
+                    }
+                    else if ( cChPrev == '-' )
+                        nScrPos = aKernArray[i-1] + nScr;
+                    else
+                    {
+                        nScrPos += nScr;
+                        nScrPos = ( nMul * nScrPos + aKernArray[i] ) / nDiv;
+                    }
+                }
 
+                // Apply SpaceSum
+                if ( nCh == CH_BLANK )
+                {
                     if ( cChPrev == CH_BLANK )
                         nSpaceSum += nOtherHalf;
                     if (i + 1 == sal_Int32(nCnt))
@@ -1711,18 +1729,11 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
                 {
                     if ( cChPrev == CH_BLANK )
                     {
-                        nScrPos = aKernArray[i-1] + nScr;
                         // no Pixel is lost:
                         nSpaceSum += nOtherHalf;
                     }
-                    else if ( cChPrev == '-' )
-                        nScrPos = aKernArray[i-1] + nScr;
-                    else
-                    {
-                        nScrPos += nScr;
-                        nScrPos = ( nMul * nScrPos + aKernArray[i] ) / nDiv;
-                    }
                 }
+
                 cChPrev = nCh;
                 aKernArray[i-1] = nScrPos - nScr + nKernSum + nSpaceSum;
                 // In word line mode and for Arabic, we disabled the half 
space trick. If a portion

Reply via email to