[Libreoffice-commits] core.git: sw/source

László Németh (via logerrit) logerrit at kemper.freedesktop.org
Sat Aug 24 09:40:34 UTC 2019


 sw/source/core/inc/swfont.hxx  |    3 +++
 sw/source/core/text/guess.cxx  |    8 +++-----
 sw/source/core/text/porlay.cxx |    2 +-
 sw/source/core/text/portxt.cxx |    3 ++-
 4 files changed, 9 insertions(+), 7 deletions(-)

New commits:
commit 9ee96273a2090b63e0f579a1e9c9cef780756e6d
Author:     László Németh <nemeth at numbertext.org>
AuthorDate: Mon Aug 12 16:44:28 2019 +0200
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Sat Aug 24 11:39:26 2019 +0200

    tdf#123703 strip six-em-space (U+2006) at line break
    
    as normal (' ') and ideographic (U+3000) spaces to get
    the same layout in justified paragraphs, too, with the
    previous RTF import fix.
    
    Note: this can be useful for manual kerning fixes
    during editing, too.
    
    Change-Id: I7c031b7d79a8703e4821da91fc60a752a1d15788
    Reviewed-on: https://gerrit.libreoffice.org/77367
    Reviewed-by: László Németh <nemeth at numbertext.org>
    Tested-by: László Németh <nemeth at numbertext.org>

diff --git a/sw/source/core/inc/swfont.hxx b/sw/source/core/inc/swfont.hxx
index 175c7c088e20..72b633611843 100644
--- a/sw/source/core/inc/swfont.hxx
+++ b/sw/source/core/inc/swfont.hxx
@@ -44,6 +44,9 @@ const sal_Unicode CH_BREAK = 0x0A;
 const sal_Unicode CH_TAB   = '\t';  // \t
 const sal_Unicode CH_PAR    = 0xB6;     // paragraph
 const sal_Unicode CH_BULLET = 0xB7;     // centered dot
+const sal_Unicode CH_FULL_BLANK = 0x3000;
+const sal_Unicode CH_NB_SPACE = 0xA0;
+const sal_Unicode CH_SIX_PER_EM = 0x2006; // six-per-em space
 
 sal_uInt16 UnMapDirection( sal_uInt16 nDir, const bool bVertFormat, const bool bVertFormatLRBT );
 
diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx
index 4c0af10e54cb..c28cccfb65bc 100644
--- a/sw/source/core/text/guess.cxx
+++ b/sw/source/core/text/guess.cxx
@@ -43,10 +43,7 @@ using namespace ::com::sun::star::linguistic2;
 
 namespace{
 
-const sal_Unicode CH_FULL_BLANK = 0x3000;
-const sal_Unicode CH_NB_SPACE = 0xA0;
-
-bool IsBlank(sal_Unicode ch) { return ch == CH_BLANK || ch == CH_FULL_BLANK || ch == CH_NB_SPACE; }
+bool IsBlank(sal_Unicode ch) { return ch == CH_BLANK || ch == CH_FULL_BLANK || ch == CH_NB_SPACE || ch == CH_SIX_PER_EM; }
 
 }
 
@@ -98,7 +95,7 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
                      sal_Int32(rInf.GetIdx()) <= i; --i)
                 {
                     sal_Unicode cChar = rInf.GetText()[i];
-                    if ( cChar != CH_BLANK && cChar != CH_FULL_BLANK )
+                    if ( cChar != CH_BLANK && cChar != CH_FULL_BLANK && cChar != CH_SIX_PER_EM )
                         break;
                     ++nSpaceCnt;
                 }
@@ -473,6 +470,7 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
                 while( nX > rInf.GetLineStart() &&
                        ( CH_TXTATR_BREAKWORD != cFieldChr || nX > rInf.GetIdx() ) &&
                        ( CH_BLANK == rInf.GetChar( --nX ) ||
+                         CH_SIX_PER_EM == rInf.GetChar( nX ) ||
                          CH_FULL_BLANK == rInf.GetChar( nX ) ) )
                     nBreakPos = nX;
             }
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index 07f8c4b8a608..e16619663f48 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -319,7 +319,7 @@ static bool lcl_HasOnlyBlanks(const OUString& rText, TextFrameIndex nStt, TextFr
     while ( nStt < nEnd )
     {
         const sal_Unicode cChar = rText[ sal_Int32(nStt++) ];
-        if ( ' ' != cChar && 0x3000 != cChar )
+        if ( ' ' != cChar && CH_FULL_BLANK != cChar && CH_SIX_PER_EM != cChar )
         {
             bBlankOnly = false;
             break;
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index d5f51c7e054a..f9aed8c08c6c 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -379,7 +379,8 @@ bool SwTextPortion::Format_( SwTextFormatInfo &rInf )
                     rInf.GetLineStart() + rInf.GetLast()->GetLen() < rInf.GetIdx() &&
                     aGuess.BreakPos() == rInf.GetIdx()  &&
                     CH_BLANK != rInf.GetChar( rInf.GetIdx() ) &&
-                    0x3000 != rInf.GetChar( rInf.GetIdx() ) ) )
+                    CH_FULL_BLANK != rInf.GetChar( rInf.GetIdx() ) &&
+                    CH_SIX_PER_EM != rInf.GetChar( rInf.GetIdx() ) ) )
             BreakUnderflow( rInf );
         // case B2
         else if( rInf.GetIdx() > rInf.GetLineStart() ||


More information about the Libreoffice-commits mailing list