[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - sw/source

Michael Stahl mstahl at redhat.com
Sun Nov 2 07:20:54 PST 2014


 sw/source/core/text/itrform2.cxx |   18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

New commits:
commit 7ca9c060155b79a037861a972843a70b8a518c4f
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Oct 29 23:50:21 2014 +0100

    fdo#79602: sw: fix text formatting of proportional line space < 100%
    
    SwTxtFormatter::CalcRealHeight(): Apply the special treatment of < 100%
    line space shrinking the Height() of the line only to the first line
    in a paragraph; the subsequent ones are shrunk again (to the square of
    the desired proportion) 30 lines later.
    
    Also set the Ascent of the line, as the wrong base-line causes the lower
    part of the line to be clipped.
    
    (regression from 42532d42bfcdb12df86376cda009e8e315a82153)
    
    (cherry picked from commit 4e223fab04279c3583689e69fa1342966e81de36)
    
    Conflicts:
    	sw/source/core/text/itrform2.cxx
    
    Change-Id: I0424396263293deaa318c80eedc2237cdb01b22b
    Reviewed-on: https://gerrit.libreoffice.org/12156
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index 2738b9b..4880013 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -1741,24 +1741,30 @@ void SwTxtFormatter::CalcRealHeight( bool bNewLine )
             switch( pSpace->GetLineSpaceRule() )
             {
                 case SVX_LINE_SPACE_AUTO:
-            if (pSpace->GetInterLineSpaceRule()==SVX_INTER_LINE_SPACE_PROP) {
+                    // shrink first line of paragraph too on spacing < 100%
+                    if (IsParaLine() &&
+                        pSpace->GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_PROP)
+                    {
                         long nTmp = pSpace->GetPropLineSpace();
+                        // Word will render < 50% too but it's just not readable
+                        if( nTmp < 50 )
+                            nTmp = nTmp ? 50 : 100;
                         if (nTmp<100) { // code adaped from fixed line height
                             nTmp *= nLineHeight;
                             nTmp /= 100;
                             if( !nTmp )
                                 ++nTmp;
                             nLineHeight = (KSHORT)nTmp;
-                            /*
-                            //@TODO figure out how WW maps ascent and descent
-                            //in case of prop  line spacing <100%
                             KSHORT nAsc = ( 4 * nLineHeight ) / 5;  // 80%
+#if 0
+                            // could do clipping here (like Word does)
+                            // but at 0.5 its unreadable either way...
                             if( nAsc < pCurr->GetAscent() ||
                                 nLineHeight - nAsc < pCurr->Height() -
                                 pCurr->GetAscent() )
                                 pCurr->SetClipping( true );
+#endif
                             pCurr->SetAscent( nAsc );
-                            */
                             pCurr->Height( nLineHeight );
                             pInf->GetParaPortion()->SetFixLineHeight();
                         }
@@ -1784,6 +1790,8 @@ void SwTxtFormatter::CalcRealHeight( bool bNewLine )
                 break;
                 default: OSL_FAIL( ": unknown LineSpaceRule" );
             }
+            // Note: for the _first_ line the line spacing of the previous
+            // paragraph is applied in SwFlowFrm::CalcUpperSpace()
             if( !IsParaLine() )
                 switch( pSpace->GetInterLineSpaceRule() )
                 {


More information about the Libreoffice-commits mailing list