sw/source/core/txtnode/fntcache.cxx | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-)
New commits: commit d744838991594eebe27acc4c7d9fb4579d654853 Author: Mark Hung <mark...@gmail.com> AuthorDate: Mon Sep 23 22:13:10 2019 +0800 Commit: Mark Hung <mark...@gmail.com> CommitDate: Sun Sep 29 05:44:27 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 <mark...@gmail.com> diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index a73ebe3ce9ec..085317e4a259 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -1203,28 +1203,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())); } } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits