sw/qa/extras/layout/data/tdf168528.odt |binary sw/qa/extras/layout/layout3.cxx | 8 ++++++++ sw/source/core/text/guess.cxx | 9 +++++++-- vcl/unx/generic/fontmanager/fontconfig.cxx | 3 +++ 4 files changed, 18 insertions(+), 2 deletions(-)
New commits: commit 8306c4e86aacfe0e2a7b2aedb88c404735dccdcd Author: László Németh <nem...@numbertext.org> AuthorDate: Wed Sep 24 12:14:57 2025 +0200 Commit: László Németh <nem...@numbertext.org> CommitDate: Thu Sep 25 10:04:24 2025 +0200 tdf#168528 sw letter spacing: fix freezing with minimum spacing/scaling Fix never-ending loop in SwTextFrame::Format_() resulted by bad compression of lines with COMPLETE_STRING cut position. Note: to test the fix of the rare freezing, a subset font has been created from Source Serif 4 Variable, and embedded in the test file. Follow-up to commit 33f20d0a0fb32bf4452c15c6ae0e7c85b2ee6d46 "tdf#168351 sw letter spacing: fix spaces in the last line", commit 45ec7bd76196dcc60b4c2db2f6f00623ecbaf5a4 "tdf#168251 cui offapi xmloff sw glyph scaling: extend UNO/UX/ODF", commit 3c53797210bf0a4e3ffb36ed2beac4d5ce229ff2 "tdf#167648 sw letter spacing: implement minimum letter spacing" and commit f83a04c51056445bbf947a31c8c1866a5c30bef1 "tdf#167648 cui offapi xmloff sw: add DTP-feature maximum letter spacing". Change-Id: I517f2b878421df40d69c785155107cf7380f0c0c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191432 Tested-by: Jenkins Reviewed-by: László Németh <nem...@numbertext.org> diff --git a/sw/qa/extras/layout/data/tdf168528.odt b/sw/qa/extras/layout/data/tdf168528.odt new file mode 100644 index 000000000000..97608cc1eefe Binary files /dev/null and b/sw/qa/extras/layout/data/tdf168528.odt differ diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx index 9ad3c18412fd..d5f2ad01ef6e 100644 --- a/sw/qa/extras/layout/layout3.cxx +++ b/sw/qa/extras/layout/layout3.cxx @@ -837,6 +837,14 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf168448) } } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf168528) +{ + //just care it doesn't freeze + // embedded font subset created with: + // hb-subset SourceSerif4Variable-Roman.ttf -u '20,3a,61,64,65,66,67,68,6c,6d,6e,6f,72,73,74,75,79' -o subset.ttf + createSwDoc("tdf168528.odt"); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf164499) { createSwDoc("tdf164499.docx"); diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx index 18732a7704ad..1088f5e949a3 100644 --- a/sw/source/core/text/guess.cxx +++ b/sw/source/core/text/guess.cxx @@ -502,7 +502,9 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf, // tdf#168251 minimum glyph scaling allows more text in the line // TODO don't be greedy, allow only an extra word or word part const sal_Int16 nScaleWidthMinimum = aAdjustItem.GetPropScaleWidthMinimum(); - if ( nScaleWidthMinimum < 100 ) + if ( nScaleWidthMinimum < 100 && + // tdf#168528 avoid freezing + m_nCutPos < TextFrameIndex(rInf.GetText().getLength()) ) { SwTwips nExtraSpace = nLineWidth / (nScaleWidthMinimum / 100.0) - nLineWidth; nLineWidth += nExtraSpace; @@ -512,7 +514,10 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf, // tdf#167648 minimum letter spacing allows more text in the line // TODO don't be greedy, allow only an extra word or word part - if ( const sal_Int16 nLetterSpacingMinimum = aAdjustItem.GetPropLetterSpacingMinimum() ) + const sal_Int16 nLetterSpacingMinimum = aAdjustItem.GetPropLetterSpacingMinimum(); + if ( nLetterSpacingMinimum && + // tdf#168528 avoid freezing + m_nCutPos < TextFrameIndex(rInf.GetText().getLength()) ) { SwTwips nExtraSpace = sal_Int32(m_nCutPos - rInf.GetIdx()) * nSpaceWidth / 10.0 * nLetterSpacingMinimum / 100.0; diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx b/vcl/unx/generic/fontmanager/fontconfig.cxx index 642a1a7ef733..8516a8b6ac9d 100644 --- a/vcl/unx/generic/fontmanager/fontconfig.cxx +++ b/vcl/unx/generic/fontmanager/fontconfig.cxx @@ -1265,6 +1265,9 @@ void PrintFontManager::Substitute(vcl::font::FontSelectPattern &rPattern, OUStri } if (rPattern.maTargetName == "Linux Libertine G" && rPattern.maSearchName == "Linux Libertine O") return; + // tdf#168528 allow testing with embedded subset + if (rPattern.maTargetName == "Source Serif 4 Variable" && rPattern.maSearchName == "DejaVu Serif") + return; SAL_WARN("vcl.fonts", "PrintFontManager::Substitute: missing font: '" << rPattern.maTargetName << "' try: " << rPattern.maSearchName << " instead"); std::cerr << "terminating test due to missing font: " << rPattern.maTargetName << std::endl;