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

New commits:
commit fd99725abdeea92e8cd46bb3e8e6fdcad8180e8a
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 05:59:33 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>

diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 52bf41312eed..4eab532af59b 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -1359,6 +1359,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