[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sw/source

Mark Hung (via logerrit) logerrit at kemper.freedesktop.org
Fri Oct 4 22:59:13 UTC 2019


 sw/source/core/txtnode/fntcache.cxx |   28 ++++++++++------------------
 1 file changed, 10 insertions(+), 18 deletions(-)

New commits:
commit 558d1975947efc08db1a2f074351b39b5c4eccb1
Author:     Mark Hung <marklh9 at gmail.com>
AuthorDate: Mon Sep 23 22:13:10 2019 +0800
Commit:     Mark Hung <marklh9 at gmail.com>
CommitDate: Sat Oct 5 00:58:29 2019 +0200

    tdf#127422 draw text with correct pKernArray values.
    
    Prior to 5f62b97ae7891b8c601f6093a1ec5358feb20790,
    
    Starting position was specified and DrawText was used to render
    the text without referring to pKernArray. After the patch,
    DrawTextArray was used but pKernArray was not update correctly.
    
    Instead of draw each substring seprated by space, this patch
    increases the values pKernArray when a space is encountered
    and call DrawTextArray only once.
    
    Change-Id: I9e61b2d0608400f26136490248740c5f00b56cc3
    Reviewed-on: https://gerrit.libreoffice.org/79544
    Tested-by: Jenkins
    Reviewed-by: Mark Hung <marklh9 at gmail.com>
    (cherry picked from commit d744838991594eebe27acc4c7d9fb4579d654853)
    Reviewed-on: https://gerrit.libreoffice.org/80221

diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index 871f9ce655ca..cc6bb0bb2cff 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -1202,28 +1202,20 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
                     }
                     else
                     {
-                        Point aTmpPos( aTextOriginPos );
                         sal_Int32 i;
-                        sal_Int32 j = 0;
                         long nSpaceSum = 0;
-                        for (i = 0; i < sal_Int32(rInf.GetLen()); i++ )
+                        for (i = 0; i < sal_Int32(rInf.GetLen()); i++)
                         {
-                            if( CH_BLANK == rInf.GetText()[ sal_Int32(rInf.GetIdx()) + i ] )
-                            {
-                                nSpaceSum += nSpaceAdd;
-                                if( j < i)
-                                    rInf.GetOut().DrawTextArray( aTmpPos, rInf.GetText(),
-                                    pKernArray.get() + j,
-                                    sal_Int32(rInf.GetIdx()) + j, i - j );
-                                j = i + 1;
-                                pKernArray[i] = pKernArray[i] + nSpaceSum;
-                                aTmpPos.setX( aTextOriginPos.X() + pKernArray[ i ] + nKernSum );
-                            }
+                            if(CH_BLANK == rInf.GetText()[sal_Int32(rInf.GetIdx()) + i])
+                                nSpaceSum += nSpaceAdd + nKernSum;
+
+                            pKernArray[i] += nSpaceSum;
                         }
-                        if( j < i )
-                            rInf.GetOut().DrawTextArray( aTmpPos, rInf.GetText(),
-                                pKernArray.get() + j,
-                                sal_Int32(rInf.GetIdx()) + j, i - j );
+
+                        rInf.GetOut().DrawTextArray(aTextOriginPos,
+                                rInf.GetText(), pKernArray.get(),
+                                sal_Int32(rInf.GetIdx()),
+                                sal_Int32(rInf.GetLen()));
                     }
                 }
             }


More information about the Libreoffice-commits mailing list