[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - vcl/coretext

Khaled Hosny khaledhosny at eglug.org
Fri Jun 28 00:03:34 PDT 2013


 vcl/coretext/ctlayout.cxx |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 28c1796a5519d1a6acfbc0387142ab62bbd91917
Author: Khaled Hosny <khaledhosny at eglug.org>
Date:   Fri Jun 21 19:21:15 2013 +0200

    Attempt to fix Core Text full justification
    
    Apparently we need to subtract the trailing white space from the desired
    line length or text will sometimes protrude to the margin.
    
    Change-Id: Iee5ef40670c2fefc189afa319387b180c4ed648d
    Reviewed-on: https://gerrit.libreoffice.org/4455
    Reviewed-by: Fridrich Strba <fridrich at documentfoundation.org>
    Tested-by: Fridrich Strba <fridrich at documentfoundation.org>

diff --git a/vcl/coretext/ctlayout.cxx b/vcl/coretext/ctlayout.cxx
index 6c2a07de..05f9aa8 100644
--- a/vcl/coretext/ctlayout.cxx
+++ b/vcl/coretext/ctlayout.cxx
@@ -139,10 +139,11 @@ void CTLayout::AdjustLayout( ImplLayoutArgs& rArgs )
         nPixelWidth = rArgs.mpDXArray[ mnCharCount - 1 ];
     }
 
+    float fTrailingSpace = CTLineGetTrailingWhitespaceWidth( mpCTLine );
     // in RTL-layouts trailing spaces are leftmost
     // TODO: use BiDi-algorithm to thoroughly check this assumption
     if( rArgs.mnFlags & SAL_LAYOUT_BIDI_RTL)
-        mnBaseAdv = rint( CTLineGetTrailingWhitespaceWidth( mpCTLine ) );
+        mnBaseAdv = rint( fTrailingSpace );
 
     // return early if there is nothing to do
     if( nPixelWidth <= 0 )
@@ -153,7 +154,7 @@ void CTLayout::AdjustLayout( ImplLayoutArgs& rArgs )
     if( (nOrigWidth >= nPixelWidth-1) && (nOrigWidth <= nPixelWidth+1) )
         return;
 
-    CTLineRef pNewCTLine = CTLineCreateJustifiedLine( mpCTLine, 1.0, nPixelWidth );
+    CTLineRef pNewCTLine = CTLineCreateJustifiedLine( mpCTLine, 1.0, nPixelWidth - fTrailingSpace );
     if( !pNewCTLine ) { // CTLineCreateJustifiedLine can and does fail
         // handle failure by keeping the unjustified layout
         // TODO: a better solution such as


More information about the Libreoffice-commits mailing list