editeng/source/editeng/impedit3.cxx |    4 ++--
 editeng/source/items/svxfont.cxx    |    4 ++--
 include/editeng/svxfont.hxx         |    2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 684d63e133fddeca68055a83d85f75bd73319d39
Author:     Attila Szűcs <attila.sz...@collabora.com>
AuthorDate: Tue Feb 20 03:19:09 2024 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Tue Feb 20 18:38:00 2024 +0100

    tdf#67347 fix stacked text kern problems
    
    Disabled some kerning calculations in case of stacked text.
    
    Without this:
    -x position of characters was strange, and the last characters
    was different.
    -thin characters, like 'j', 'i', ' ', ... could result issues
    at editing the text. (if width of character + kern was < 0)
    
    Change-Id: I40a23ef445fc9683a1cfd619ea23f1536c525d1c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163608
    Tested-by: Jenkins
    Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index b54e1328a0ac..8bbcebcebf2a 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -1249,14 +1249,14 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
 
                 if (bContinueLastPortion)
                 {
-                     Size aSize = aTmpFont.QuickGetTextSize( GetRefDevice(), 
rParaPortion.GetNode()->GetString(), nTmpPos, nPortionLen, &aCharPositionArray);
+                     Size aSize = aTmpFont.QuickGetTextSize( GetRefDevice(), 
rParaPortion.GetNode()->GetString(), nTmpPos, nPortionLen, &aCharPositionArray, 
bStacked);
                      pPortion->adjustSize(aSize.Width(), 0);
                      if (pPortion->GetSize().Height() < aSize.Height())
                          pPortion->setHeight(aSize.Height());
                 }
                 else
                 {
-                    Size aSize = aTmpFont.QuickGetTextSize(GetRefDevice(), 
rParaPortion.GetNode()->GetString(), nTmpPos, nPortionLen, &aCharPositionArray);
+                    Size aSize = aTmpFont.QuickGetTextSize(GetRefDevice(), 
rParaPortion.GetNode()->GetString(), nTmpPos, nPortionLen, &aCharPositionArray, 
bStacked);
                     pPortion->SetSize(aSize);
                 }
 
diff --git a/editeng/source/items/svxfont.cxx b/editeng/source/items/svxfont.cxx
index 876bc06868f8..a4367de4680e 100644
--- a/editeng/source/items/svxfont.cxx
+++ b/editeng/source/items/svxfont.cxx
@@ -442,7 +442,7 @@ Size SvxFont::GetPhysTxtSize( const OutputDevice *pOut )
 }
 
 Size SvxFont::QuickGetTextSize( const OutputDevice *pOut, const OUString &rTxt,
-                         const sal_Int32 nIdx, const sal_Int32 nLen, 
KernArray* pDXArray ) const
+                         const sal_Int32 nIdx, const sal_Int32 nLen, 
KernArray* pDXArray, bool bStacked ) const
 {
     if ( !IsCaseMap() && !IsFixKerning() )
     {
@@ -477,7 +477,7 @@ Size SvxFont::QuickGetTextSize( const OutputDevice *pOut, 
const OUString &rTxt,
     }
     SAL_INFO( "editeng.quicktextsize", "SvxFont::QuickGetTextSize after 
GetTextArray(): Text length: " << nLen << " Text size: " << aTxtSize.Width() << 
"x" << aTxtSize.Height());
 
-    if( IsFixKerning() && ( nLen > 1 ) )
+    if( IsFixKerning() && ( nLen > 1 ) && !bStacked)
     {
         auto nKern = GetFixKerning();
         tools::Long nOldValue = (*pDXArray)[0];
diff --git a/include/editeng/svxfont.hxx b/include/editeng/svxfont.hxx
index a86e2097f80a..126b56f8f65f 100644
--- a/include/editeng/svxfont.hxx
+++ b/include/editeng/svxfont.hxx
@@ -101,7 +101,7 @@ public:
 
     Size QuickGetTextSize( const OutputDevice *pOut, const OUString &rTxt,
                            const sal_Int32 nIdx, const sal_Int32 nLen,
-                           KernArray* pDXArray = nullptr ) const;
+                           KernArray* pDXArray = nullptr, bool bStacked = 
false ) const;
 
     void DrawPrev( OutputDevice* pOut, Printer* pPrinter,
                    const Point &rPos, const OUString &rTxt,

Reply via email to