svx/source/customshapes/EnhancedCustomShapeFontWork.cxx | 7 +++++++ 1 file changed, 7 insertions(+)
New commits: commit 67a5469f1cc40253453f1248622d2e52c92964ab Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue Apr 12 12:14:28 2022 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Tue Apr 12 15:16:34 2022 +0200 ofz#46639 Timeout Change-Id: I04f61749104bd21fa53edefd57a737d85c1d4faa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132898 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 f1cb1f7290b1..40b7f222dad9 100644 --- a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx @@ -173,6 +173,8 @@ static void CalculateHorizontalScalingFactor( const SvxFontHeightItem& rFontHeight( rSdrObjCustomShape.GetMergedItem( EE_CHAR_FONTHEIGHT ) ); sal_Int32 nFontSize = rFontHeight.GetHeight(); + SAL_WARN_IF(nFontSize > SAL_MAX_INT16, "svx", "CalculateHorizontalScalingFactor suspiciously large font height: " << nFontSize); + if (rFWData.bScaleX) aFont.SetFontHeight( nFontSize ); else @@ -236,6 +238,11 @@ static void CalculateHorizontalScalingFactor( if (fScalingFactor < 1.0) { + // if we have a ridiculously large font (flagged with the SAL_WARN + // above) that will require scaling down to a very small value then + // skip directly to a small font size + if (nFontSize > SAL_MAX_INT16 && fScalingFactor * nFontSize < 1.0) + nFontSize = 16; nFontSize--; aFont.SetFontHeight( nFontSize ); pVirDev->SetFont( aFont );