sw/source/ui/misc/pggrid.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
New commits: commit e6b070d3da4a3be84fa84d0b8c447d58be6d8923 Author: Kevin Suo <suokunl...@126.com> AuthorDate: Thu Nov 3 23:26:28 2022 +0800 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Thu Nov 10 20:53:39 2022 +0100 tdf#151544: Page grid: ruby height should be zero when not in square page mode Ruby height is used to show the ruby line in square page mode only (e.g. to show the Pinyin etc above or below base line). When not in square page mode (i.e., when in normal mode), the ruby height should be zero. The code was trying to set the ruby height to zero by using the following: m_xRubySizeMF->set_value(0, FieldUnit::TWIP); and then pass this to aGridItem.SetRubyHeight in SwTextGridPage::PutGridItem. However, there seems to be always a conversion loss, thus each line will have a tiny ruby height, which makes the vertical space not enough to hold the desired number of lines on the page. Fix this by setting ruby height to zero directly in SwTextGridPage::PutGridItem if we are not in square page mode. Change-Id: I24a74b96c12eb58e46e163e2a9c73b540023ab39 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142243 Tested-by: Jenkins Tested-by: Caolán McNamara <caol...@redhat.com> Reviewed-by: Caolán McNamara <caol...@redhat.com> (cherry picked from commit 875c27dc7975de9b007a215fe1d6f171b4ef090e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142514 diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx index db3ade6edb6b..f849f6dcc48a 100644 --- a/sw/source/ui/misc/pggrid.cxx +++ b/sw/source/ui/misc/pggrid.cxx @@ -232,7 +232,12 @@ void SwTextGridPage::PutGridItem(SfxItemSet& rSet) aGridItem.SetBaseHeight( static_cast< sal_uInt16 >( m_bRubyUserValue ? m_nRubyUserValue : m_xTextSizeMF->denormalize(m_xTextSizeMF->get_value(FieldUnit::TWIP))) ); - aGridItem.SetRubyHeight( static_cast< sal_uInt16 >(m_xRubySizeMF->denormalize(m_xRubySizeMF->get_value(FieldUnit::TWIP))) ); + // Tdf#151544: set ruby height from the value get from UI only when in square page mode. + // When in normal mode, the ruby height should be zero. + if (m_bSquaredMode) + aGridItem.SetRubyHeight(static_cast<sal_uInt16>(m_xRubySizeMF->denormalize(m_xRubySizeMF->get_value(FieldUnit::TWIP)))); + else + aGridItem.SetRubyHeight(0); aGridItem.SetBaseWidth( static_cast< sal_uInt16 >(m_xCharWidthMF->denormalize(m_xCharWidthMF->get_value(FieldUnit::TWIP))) ); aGridItem.SetRubyTextBelow(m_xRubyBelowCB->get_active()); aGridItem.SetSquaredMode(m_bSquaredMode); @@ -385,7 +390,6 @@ IMPL_LINK(SwTextGridPage, CharorLineChangedHdl, weld::SpinButton&, rField, void) assert(nValue && "div-by-zero"); auto nHeight = m_aPageSize.Height() / nValue; m_xTextSizeMF->set_value(m_xTextSizeMF->normalize(nHeight), FieldUnit::TWIP); - m_xRubySizeMF->set_value(0, FieldUnit::TWIP); SetLinesOrCharsRanges( *m_xLinesRangeFT , m_xLinesPerPageNF->get_max() ); m_nRubyUserValue = nHeight;