tdf#72341 sw: Make inc/dec font size affect all scripts

This change updates the FN_GROW_FONT_SIZE and FN_SHRINK_FONT_SIZE
handlers to scale fonts for all script types, even if the
currently-selected text does not contain a particular type.

This fixes the reported issue that bullets in RTL context are not
resized if a selected list item does not contain CTL characters. This
also fixes the broader issue of inserted text not reflecting earlier
size changes, simply because the script type for that inserted text
wasn't present at the time.

Change-Id: I881f0b90b5c3aecbbf2e40ee2ad6758de9c5bad3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192459
Reviewed-by: Jonathan Clark <jonathan@libreoffice.org>
Tested-by: Jenkins
This commit is contained in:
Jonathan Clark
2025-10-16 00:24:40 +02:00
parent 72e79a4d75
commit 7cbd793cfc
2 changed files with 30 additions and 1 deletions
+28
View File
@@ -2087,6 +2087,34 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf168116)
assertXPath(pXmlDoc, "//body/txt[1]/SwParaPortion/SwLineLayout", 1);
}
CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf72341GrowAllScripts)
{
createSwDoc();
auto* pWrtShell = getSwDocShell()->GetWrtShell();
pWrtShell->Insert(u"AAAAאאאא"_ustr);
pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect*/ false, 7, /*bBasicCall*/ false);
pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect*/ true, 2, /*bBasicCall*/ false);
for (size_t i = 0; i < 4; ++i)
{
dispatchCommand(mxComponent, u".uno:Grow"_ustr, {});
}
pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect*/ false, 1, /*bBasicCall*/ false);
pWrtShell->Insert(u"אאאא"_ustr);
auto pXmlDoc = parseLayoutDump();
auto nWidthAlephResized
= getXPath(pXmlDoc, "//SwLineLayout/SwMultiPortion[1]", "width").toInt32();
auto nWidthAlephInitial
= getXPath(pXmlDoc, "//SwLineLayout/SwMultiPortion[2]", "width").toInt32();
CPPUNIT_ASSERT_GREATER(nWidthAlephInitial, nWidthAlephResized);
}
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+2 -1
View File
@@ -261,7 +261,8 @@ void SwTextShell::ExecCharAttrArgs(SfxRequest &rReq)
rWrtSh.GetCurAttr( aSetItem.GetItemSet() );
SfxItemSet aAttrSet( rPool, aSetItem.GetItemSet().GetRanges() );
SvtScriptType nScriptTypes = rWrtSh.GetScriptType();
SvtScriptType nScriptTypes
= SvtScriptType::LATIN | SvtScriptType::ASIAN | SvtScriptType::COMPLEX;
const SvxFontHeightItem* pSize( static_cast<const SvxFontHeightItem*>(
aSetItem.GetItemOfScript( nScriptTypes ) ) );
std::vector<std::pair< const SfxPoolItem*, std::unique_ptr<SwPaM> >> vItems;