[Libreoffice-commits] core.git: vcl/qa vcl/quartz

Khaled Hosny khaledhosny at eglug.org
Sun Feb 26 23:25:04 UTC 2017


 vcl/qa/cppunit/complextext.cxx |    3 ---
 vcl/quartz/ctfonts.cxx         |    9 +++++----
 2 files changed, 5 insertions(+), 7 deletions(-)

New commits:
commit af871d02914c9fc6a08079f67b4af71a198e166a
Author: Khaled Hosny <khaledhosny at eglug.org>
Date:   Mon Feb 27 00:44:14 2017 +0200

    Round glyph bbox on Mac similar to other platforms
    
    Core Text API gives us float bounding box that we round ourselves, on
    other platforms we get rounding integers. Try to use the same rounding
    on Mac as FreeType does internally, hopefully this is the same on
    Windows.
    
    Change-Id: I7eb08464b008174270880575c4f3df28ede5c89d
    Reviewed-on: https://gerrit.libreoffice.org/34661
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Khaled Hosny <khaledhosny at eglug.org>

diff --git a/vcl/qa/cppunit/complextext.cxx b/vcl/qa/cppunit/complextext.cxx
index 58c1080..1cb09e0 100644
--- a/vcl/qa/cppunit/complextext.cxx
+++ b/vcl/qa/cppunit/complextext.cxx
@@ -59,12 +59,9 @@ void VclComplexTextTest::testArabic()
     CPPUNIT_ASSERT_EQUAL(13L, pOutDev->GetTextHeight());
 
     // exact bounding rectangle, not essentially the same as text width/height
-#ifndef MACOSX
-    // FIXME: fails on mac, probably different rounding strategy.
     Rectangle aBoundRect;
     pOutDev->GetTextBoundRect(aBoundRect, aOneTwoThree);
     CPPUNIT_ASSERT_EQUAL(Rectangle(0, 1, 71, 15), aBoundRect);
-#endif
 
     // normal orientation
     Rectangle aInput;
diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx
index b5db7e5..42e1169 100644
--- a/vcl/quartz/ctfonts.cxx
+++ b/vcl/quartz/ctfonts.cxx
@@ -166,10 +166,11 @@ bool CoreTextStyle::GetGlyphBoundRect(const GlyphItem& rGlyph, Rectangle& rRect
     if (mfFontRotation && !rGlyph.IsVertical())
         aCGRect = CGRectApplyAffineTransform(aCGRect, CGAffineTransformMakeRotation(mfFontRotation));
 
-    rRect.Left()   = lrint( aCGRect.origin.x );
-    rRect.Top()    = lrint(-aCGRect.origin.y - aCGRect.size.height );
-    rRect.Right()  = lrint( aCGRect.origin.x + aCGRect.size.width );
-    rRect.Bottom() = lrint(-aCGRect.origin.y );
+    long xMin = floor(aCGRect.origin.x);
+    long yMin = floor(aCGRect.origin.y);
+    long xMax = ceil(aCGRect.origin.x + aCGRect.size.width);
+    long yMax = ceil(aCGRect.origin.y + aCGRect.size.height);
+    rRect = Rectangle(xMin, -yMax, xMax, -yMin);
     return true;
 }
 


More information about the Libreoffice-commits mailing list