svx/source/svdraw/svdotext.cxx |    3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 3e418c2a92f0c3fb95929245421b0387976b64c2
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Sat Apr 29 11:05:00 2023 +0900
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Sat Apr 29 11:17:23 2023 +0200

    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 <qui...@gmail.com>
    (cherry picked from commit fd99725abdeea92e8cd46bb3e8e6fdcad8180e8a)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151179
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index c49de7fddfae..afe2b7ac4d2c 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -1360,6 +1360,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();

Reply via email to