vcl/source/gdi/sallayout.cxx |   19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

New commits:
commit d8963ecd20579a62906eae3ed14d498bf07cbb98
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Tue Jun 28 15:27:57 2022 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Tue Jun 28 20:34:39 2022 +0200

    tdf#149755 bottom of characters missing in dwrite rendered case
    
    snap bounding box to full pixels
    
    Change-Id: Iecd973e99cec49ee129bad422ae00f558f057abd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136546
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index d76d72c490e9..0e582015adc8 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -238,12 +238,19 @@ bool SalLayout::GetBoundRect(tools::Rectangle& rRect) 
const
         // get bounding rectangle of individual glyph
         if (pGlyph->GetGlyphBoundRect(pGlyphFont, aRectangle))
         {
-            // merge rectangle
-            aRectangle += Point(aPos.getX(), aPos.getY());
-            if (rRect.IsEmpty())
-                rRect = aRectangle;
-            else
-                rRect.Union(aRectangle);
+            if (!aRectangle.IsEmpty())
+            {
+                aRectangle.AdjustLeft(std::floor(aPos.getX()));
+                aRectangle.AdjustRight(std::ceil(aPos.getX()));
+                aRectangle.AdjustTop(std::floor(aPos.getY()));
+                aRectangle.AdjustBottom(std::ceil(aPos.getY()));
+
+                // merge rectangle
+                if (rRect.IsEmpty())
+                    rRect = aRectangle;
+                else
+                    rRect.Union(aRectangle);
+            }
             bRet = true;
         }
     }

Reply via email to