diff options
author | Khaled Hosny <khaledhosny@eglug.org> | 2017-02-27 00:44:14 +0200 |
---|---|---|
committer | Khaled Hosny <khaledhosny@eglug.org> | 2017-02-26 23:24:37 +0000 |
commit | af871d02914c9fc6a08079f67b4af71a198e166a (patch) | |
tree | 02bab5c32c9a18f508f353753f43902f8264091e /vcl/quartz | |
parent | eb7b03b052ffe8c2c577b2349987653db6c53f76 (diff) |
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@libreoffice.org>
Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>
Diffstat (limited to 'vcl/quartz')
-rw-r--r-- | vcl/quartz/ctfonts.cxx | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx index b5db7e572226..42e1169a37aa 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; } |