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

New commits:
commit e92cb38d63187af20c894c63988ca3a7d35d6f04
Author:     Jonathan Clark <jonat...@libreoffice.org>
AuthorDate: Tue May 20 08:20:02 2025 -0600
Commit:     Jonathan Clark <jonat...@libreoffice.org>
CommitDate: Tue May 20 20:46:45 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

diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index ce4e4ad73cb4..ced75edbc26b 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -353,12 +353,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