vcl/source/gdi/sallayout.cxx |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 460bbdfcb198de637d51ddf6be99d9039ebf8f48
Author:     Jonathan Clark <jonat...@libreoffice.org>
AuthorDate: Tue May 20 08:20:02 2025 -0600
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Thu May 22 10:35:36 2025 +0200

    tdf#162325 vcl: Fix overlapping CJK in vertical justified layouts
    
    This change fixes a logic error causing the rightmost (bottom-most)
    glyph to be shifted incorrectly inside GenericSalLayout::Justify() in
    vertical CJK text.
    
    Change-Id: I525df1496f576ddab26e051adc5e544896fe86e9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185567
    Reviewed-by: Jonathan Clark <jonat...@libreoffice.org>
    Tested-by: Jenkins
    (cherry picked from commit e92cb38d63187af20c894c63988ca3a7d35d6f04)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185576
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index 04f98e22c8e6..b85c100364fd 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -352,12 +352,14 @@ void GenericSalLayout::Justify(double nNewWidth)
     }
 
     // move rightmost glyph to requested position
-    nOldWidth -= pGlyphIterRight->origWidth();
+    auto nRightGlyphOffset = nOldWidth - pGlyphIterRight->linearPos().getX();
+    nOldWidth -= nRightGlyphOffset;
+
     if( nOldWidth <= 0.0 )
         return;
     if( nNewWidth < nMaxGlyphWidth)
         nNewWidth = nMaxGlyphWidth;
-    nNewWidth -= pGlyphIterRight->origWidth();
+    nNewWidth -= nRightGlyphOffset;
     pGlyphIterRight->setLinearPosX( nNewWidth );
 
     // justify glyph widths and positions

Reply via email to