svx/source/customshapes/EnhancedCustomShapeFontWork.cxx |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

New commits:
commit 2e1e14b7d0fab28858a54340636de01ed6eb4bc0
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Mon Apr 25 11:53:29 2022 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Tue Apr 26 15:49:00 2022 +0200

    ofz#46901 Timeout
    
    Change-Id: I458ddb6ee4d7023f60c8d1c26699bbd74502ddc8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133375
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx 
b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
index 70fff24c9ba0..9f212299c512 100644
--- a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
@@ -240,10 +240,15 @@ static void CalculateHorizontalScalingFactor(
         {
             // if we have a very large font that will require scaling down to 
a very small value then
             // skip directly to a small font size
-            if (nFontSize > 128 && fScalingFactor * nFontSize < 1.0)
+            if (nFontSize > 128)
             {
-                nFontSize = 16;
-                SAL_WARN("svx", "CalculateHorizontalScalingFactor skipping 
direct to: " << nFontSize << " from " << rFontHeight.GetHeight());
+                int nEstimatedFinalFontSize = std::ceil(nFontSize * 
fScalingFactor);
+                int nFontThth = nFontSize / 1000;
+                if (nEstimatedFinalFontSize < nFontThth)
+                {
+                    nFontSize = std::max(16, nFontThth);
+                    SAL_WARN("svx", "CalculateHorizontalScalingFactor skipping 
direct to: " << nFontSize << " from " << rFontHeight.GetHeight());
+                }
             }
             nFontSize--;
             aFont.SetFontHeight( nFontSize );

Reply via email to