sw/qa/core/text/text.cxx           |    2 +-
 sw/qa/core/txtnode/justify.cxx     |    4 +++-
 sw/source/core/text/porlay.cxx     |    6 +++---
 sw/source/core/txtnode/justify.cxx |    8 ++++----
 4 files changed, 11 insertions(+), 9 deletions(-)

New commits:
commit 92c39395127c869ee1014a70ed336496e26c974a
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Thu Oct 31 14:33:40 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Nov 1 12:51:59 2024 +0100

    use double in SpaceDistribution
    
    after
        commit 11b15571475414ef853e21a6c96afa2ac81f848f
        "convert KernArray from sal_Int32 to double"
    
    Change-Id: I22f26e20f2115079dfe90189f580c4e7989a256b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175872
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Tested-by: Jenkins

diff --git a/sw/qa/core/txtnode/justify.cxx b/sw/qa/core/txtnode/justify.cxx
index 495c3037a062..263c8ade3a43 100644
--- a/sw/qa/core/txtnode/justify.cxx
+++ b/sw/qa/core/txtnode/justify.cxx
@@ -79,7 +79,9 @@ CPPUNIT_TEST_FIXTURE(SwCoreJustifyTest, 
testSpaceDistributionHalfSpace)
     // Related to: tdf#149017
     static constexpr OUStringLiteral aText = u"ne del pro";
     CharWidthArray aActual{ 720, 639, 360, 720, 639, 400, 360, 720, 480, 720 };
-    CharWidthArray aExpected{ 720, 851, 573, 720, 639, 612, 573, 720, 480, 720 
};
+    CharWidthArray aExpected{
+        720.0, 851.5, 572.5, 720.0, 639.0, 612.5, 572.5, 720.0, 480.0, 720.0
+    };
 
     aActual.InvokeWithKernArray(
         [&] { sw::Justify::SpaceDistribution(aActual.maArray, aText, 0, 10, 
425, 0, false); });
diff --git a/sw/source/core/txtnode/justify.cxx 
b/sw/source/core/txtnode/justify.cxx
index e1ea949b5613..31a7611977ff 100644
--- a/sw/source/core/txtnode/justify.cxx
+++ b/sw/source/core/txtnode/justify.cxx
@@ -113,10 +113,10 @@ void SpaceDistribution(KernArray& rKernArray, 
std::u16string_view aText, sal_Int
     // A Space at the beginning or end of the text must be positioned
     // before (resp. after) the whole intermediate space, otherwise
     // the underline/strike-through would have gaps.
-    tools::Long nSpaceSum = 0;
+    double nSpaceSum = 0;
     // in word line mode and for Arabic, we disable the half space trick:
-    const tools::Long nHalfSpace = bNoHalfSpace ? 0 : nSpaceAdd / 2;
-    const tools::Long nOtherHalf = nSpaceAdd - nHalfSpace;
+    const double nHalfSpace = bNoHalfSpace ? 0 : nSpaceAdd / 2.0;
+    const double nOtherHalf = nSpaceAdd - nHalfSpace;
     tools::Long nKernSum = nKern;
     sal_Unicode cChPrev = aText[nStt];
 
@@ -161,7 +161,7 @@ void SpaceDistribution(KernArray& rKernArray, 
std::u16string_view aText, sal_Int
             rKernArray[nPrevIdx] += -nSpaceAdd;
 
         // Advance nPrevIdx and assign kern values to previous cluster.
-        for (tools::Long nValue = rKernArray[nPrevIdx++]; nPrevIdx < i; 
++nPrevIdx)
+        for (double nValue = rKernArray[nPrevIdx++]; nPrevIdx < i; ++nPrevIdx)
             rKernArray[nPrevIdx] = nValue;
     }
 
commit 7f56a80b205555cfc85b01b4f641ab7f78968403
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Thu Oct 31 13:32:21 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Nov 1 12:51:51 2024 +0100

    use double in SwScriptInfo::Compress
    
    after
    commit 11b15571475414ef853e21a6c96afa2ac81f848f
    "convert KernArray from sal_Int32 to double"
    
    Change-Id: I566fbb04a20e5d0ed64c1f43e51fe3323e5b2f67
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175868
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Tested-by: Jenkins

diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx
index 6dc3e933a2dc..b81146642bd4 100644
--- a/sw/qa/core/text/text.cxx
+++ b/sw/qa/core/text/text.cxx
@@ -1625,7 +1625,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf129810)
             // Assert we are using the expected width for uncompressed chars
             CPPUNIT_ASSERT_EQUAL(sal_Int32(720), sal_Int32(pDXArray[0]));
             // Assert we are using the expected width for compressed chars
-            CPPUNIT_ASSERT_EQUAL(sal_Int32(500), sal_Int32(pDXArray[6] - 
pDXArray[5]));
+            CPPUNIT_ASSERT_EQUAL(sal_Int32(499), sal_Int32(pDXArray[6] - 
pDXArray[5]));
             break;
         }
     }
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index 99e00aa071df..e8096fe85b57 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -2092,8 +2092,8 @@ tools::Long SwScriptInfo::Compress(KernArray& rKernArray, 
TextFrameIndex nIdx, T
     if( nIdx > nLen || nCompIdx >= nCompCount )
         return 0;
 
-    tools::Long nSub = 0;
-    tools::Long nLast = nI ? rKernArray[ nI - 1 ] : 0;
+    double nSub = 0;
+    double nLast = nI ? rKernArray[ nI - 1 ] : 0;
     do
     {
         const CompType nType = GetCompType( nCompIdx );
@@ -2119,7 +2119,7 @@ tools::Long SwScriptInfo::Compress(KernArray& rKernArray, 
TextFrameIndex nIdx, T
                 nLast -= rKernArray[ nI ];
 
                 nLast *= nCompress;
-                tools::Long nMove = 0;
+                double nMove = 0;
                 if( SwScriptInfo::KANA != nType )
                 {
                     nLast /= 24000;

Reply via email to