summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAttila Bakos <bakos.attilakaroly@nisz.hu>2020-09-22 16:37:22 +0200
committerGabor Kelemen <kelemen.gabor2@nisz.hu>2020-10-14 23:28:30 +0200
commitb16a19330820b3b7d11ca342ac0f26b13afd4f42 (patch)
tree60b1ae99576c4713a40418dadd5ed8a83e3c8a28
parent9ca974ddb5ba89b09c1c2cfd7efced5895fbead5 (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> (cherry picked from commit 0d28097fadf44ed58cb5e3e9b9c04a65a7a33fd6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104329 Tested-by: Gabor Kelemen <kelemen.gabor2@nisz.hu> Reviewed-by: Gabor Kelemen <kelemen.gabor2@nisz.hu>
-rw-r--r--sw/qa/extras/layout/data/tdf136588.docxbin0 -> 17297 bytes
-rw-r--r--sw/qa/extras/layout/layout.cxx11
-rw-r--r--sw/source/core/txtnode/fntcache.cxx7
3 files changed, 18 insertions, 0 deletions
diff --git a/sw/qa/extras/layout/data/tdf136588.docx b/sw/qa/extras/layout/data/tdf136588.docx
new file mode 100644
index 000000000000..606931286470
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf136588.docx
Binary files differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 3a35e5d8b297..ccab53a7f920 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -204,6 +204,17 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFootnotes)
CheckRedlineFootnotesHidden();
}
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf136588)
+{
+ load(DATA_DIRECTORY, "tdf136588.docx");
+ auto pXMLLayoutDump = parseLayoutDump();
+ CPPUNIT_ASSERT(pXMLLayoutDump);
+
+ //there was a bad line break before, the correct break layout is this:
+ assertXPath(pXMLLayoutDump, "/root/page/body/txt[2]/LineBreak[2]", "Line",
+ "effectively by modern-day small to ");
+}
+
CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInBody)
{
loadURL("private:factory/swriter", nullptr);
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index 6fa6b159705a..ccd509449048 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;