summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2019-08-12 16:44:28 +0200
committerLászló Németh <nemeth@numbertext.org>2019-08-24 11:39:26 +0200
commit9ee96273a2090b63e0f579a1e9c9cef780756e6d (patch)
treec3f7b5da9b8d1c3e02fbcaca1937ec6b5027bced /sw
parent24b04db5a63b57a74e58a7616091437ad68548ac (diff)
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@numbertext.org> Tested-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/inc/swfont.hxx3
-rw-r--r--sw/source/core/text/guess.cxx8
-rw-r--r--sw/source/core/text/porlay.cxx2
-rw-r--r--sw/source/core/text/portxt.cxx3
4 files changed, 9 insertions, 7 deletions
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() ||