summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorAttila Bakos <bakos.attilakaroly@nisz.hu>2020-09-22 16:37:22 +0200
committerLászló Németh <nemeth@numbertext.org>2020-09-24 13:54:23 +0200
commit0d28097fadf44ed58cb5e3e9b9c04a65a7a33fd6 (patch)
tree5554d002b2d68f100f207bde14d483f6a017b47b /sw/source
parent05dc3a8f5d88819356a754450c204ca9f11d282d (diff)
tdf#136588 sw: fix line break regression with small caps
Regression from commit 1b03a449161af225302e4b4dd2bb2e69c6d8d170 (tdf#112290 sw: fix missing line break in small capital). This replaces the previous commit with a better solution. Change-Id: I7510b78cd6520f260e6a3804ec69e0364b93440f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103178 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/text/portxt.cxx3
-rw-r--r--sw/source/core/txtnode/fntcache.cxx7
2 files changed, 8 insertions, 2 deletions
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index 398b26e6706b..ace126870b54 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -344,8 +344,7 @@ bool SwTextPortion::Format_( SwTextFormatInfo &rInf )
Insert( aGuess.ReleaseHangingPortion() );
}
// breakPos >= index
- else if (aGuess.BreakPos() >= rInf.GetIdx() && aGuess.BreakPos() != TextFrameIndex(COMPLETE_STRING)
- && rInf.GetFont()->GetCaseMap() != SvxCaseMap::SmallCaps )
+ else if (aGuess.BreakPos() >= rInf.GetIdx() && aGuess.BreakPos() != TextFrameIndex(COMPLETE_STRING))
{
// case B1
if( aGuess.HyphWord().is() && aGuess.BreakPos() > rInf.GetLineStart()
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index 5d7188a0f4a1..b55821032936 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -2536,6 +2536,13 @@ TextFrameIndex SwFont::GetTextBreak(SwDrawTextInfo const & rInf, long nTextWidth
? TextFrameIndex(COMPLETE_STRING)
: nTextBreak;
+ // tdf112290 tdf136588 Break the line correctly only if there is an image inline,
+ // and the image wider than the line...
+ if (GetCaseMap() == SvxCaseMap::SmallCaps && TextFrameIndex(COMPLETE_STRING) == nTextBreak2 &&
+ ! bCompress && nTextWidth == 0)
+ // If nTextWidth == 0 means the line is full, we have to break it
+ nTextBreak2 = TextFrameIndex(1);
+
if ( ! bCompress )
return nTextBreak2;