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

New commits:
commit 01c14670554b2c93de79f07a71a3f94d81a2178d
Author:     Mark Hung <mark...@gmail.com>
AuthorDate: Fri May 13 00:11:37 2022 +0800
Commit:     Mark Hung <mark...@gmail.com>
CommitDate: Tue May 17 13:56:28 2022 +0200

    vcl/GetTextBreak(): don't add extra width if char width is 0.
    
    Char width is 0 when multiple characters made up of one glyph.
    Don't insert extra space in that case.
    
    Change-Id: Ieb37aa8a4fffc534d84acf994a231e801e89f782
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134244
    Tested-by: Jenkins
    Reviewed-by: Mark Hung <mark...@gmail.com>

diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index 17d5bfbb6c20..81897ac68bbd 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -492,10 +492,16 @@ sal_Int32 GenericSalLayout::GetTextBreak( 
DeviceCoordinate nMaxWidth, DeviceCoor
     DeviceCoordinate nWidth = 0;
     for( int i = mnMinCharPos; i < mnEndCharPos; ++i )
     {
-        nWidth += aCharWidths[ i - mnMinCharPos ] * nFactor;
-        if( nWidth > nMaxWidth )
-            return i;
-        nWidth += nCharExtra;
+        DeviceCoordinate nDelta =  aCharWidths[ i - mnMinCharPos ] * nFactor;
+
+        if (nDelta != 0)
+        {
+            nWidth += nDelta;
+            if( nWidth > nMaxWidth )
+                return i;
+
+            nWidth += nCharExtra;
+        }
     }
 
     return -1;

Reply via email to