drawinglayer/source/primitive2d/textlayoutdevice.cxx |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

New commits:
commit 8a97f1ba8d9ccb65b2c89106de20666311d90c30
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Mon Apr 22 14:45:37 2024 +0500
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Mon Apr 22 16:30:12 2024 +0200

    tdf#160773: handle 0-size font height
    
    Regression from commit cc3663bbaed4f65d64154e5f9abb51a5f622f710
    (tdf#160702: improve text positioning, 2024-04-20), where I didn't
    know yet that this was possible :-)
    
    Change-Id: I1316db48b8acbacd077eeb4a8989c3dbf7e4a7b5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166425
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx 
b/drawinglayer/source/primitive2d/textlayoutdevice.cxx
index cb3af255fd0e..bfa414d40f42 100644
--- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx
+++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx
@@ -179,8 +179,17 @@ void TextLayouterDevice::setFontAttribute(const 
attribute::FontAttribute& rFontA
         = getVclFontFromFontAttribute(rFontAttribute, fFontScaleX, 
fFontScaleY, 0.0, rLocale);
     setFont(aFont);
     Size aFontSize = aFont.GetFontSize();
-    mnFontScalingFixY = fFontScaleY / aFontSize.Height();
-    mnFontScalingFixX = fFontScaleX / (aFontSize.Width() ? aFontSize.Width() : 
aFontSize.Height());
+    if (aFontSize.Height())
+    {
+        mnFontScalingFixY = fFontScaleY / aFontSize.Height();
+        // aFontSize.Width() is 0 for uninformly scaled fonts: see 
getVclFontFromFontAttribute
+        mnFontScalingFixX
+            = fFontScaleX / (aFontSize.Width() ? aFontSize.Width() : 
aFontSize.Height());
+    }
+    else
+    {
+        mnFontScalingFixX = mnFontScalingFixY = 0;
+    }
 }
 
 double TextLayouterDevice::getOverlineOffset() const

Reply via email to