diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2023-04-29 11:05:00 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2023-05-01 07:46:25 +0200 |
commit | 34c2e782e19f96230fe14f59c28f255d0f53e25c (patch) | |
tree | 3f1af3fafaf6c3b106ee687ed5e1a47258853d4f | |
parent | tdf#155011: Fix assert/check (diff) | |
download | core-34c2e782e19f96230fe14f59c28f255d0f53e25c.tar.gz core-34c2e782e19f96230fe14f59c28f255d0f53e25c.zip |
Prevent to get 0 font size in the auto-fitting algorithm
When the text box is empty, the size of the box can be returned
as (0,0) so the auto-fitting algorithm will calculate the scaling
to 0%, which means the text is shrinked to very small size or is
invisible.
This change fixes the issue so that if the size is (0,0) we just
return and leave the scaling at 100%.
Change-Id: Ie359461f23a1f7a496eb03b5670f588ad48bbf49
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151178
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
(cherry picked from commit fd99725abdeea92e8cd46bb3e8e6fdcad8180e8a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151180
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
-rw-r--r-- | svx/source/svdraw/svdotext.cxx | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx index d9a80a9cfb0b..f979818ee073 100644 --- a/svx/source/svdraw/svdotext.cxx +++ b/svx/source/svdraw/svdotext.cxx @@ -1376,6 +1376,9 @@ void SdrTextObj::autoFitTextForCompatibility(SdrOutliner& rOutliner, const Size& } Size aCurrentTextBoxSize = rOutliner.CalcTextSizeNTP(); + if (aCurrentTextBoxSize.Height() == 0) + return; + tools::Long nExtendTextBoxBy = -50; aCurrentTextBoxSize.extendBy(0, nExtendTextBoxBy); double fCurrentFitFactor = double(rTextBoxSize.Height()) / aCurrentTextBoxSize.Height(); |