MacViews: Fix vertical alignment of text rendering.

NSFont returns fractional values for font metrics. We were truncating the
values, causing text to appear too high vertically. The fix is to apply the
ceiling function instead.

BUG=401345

Review URL: https://codereview.chromium.org/445363006

Cr-Commit-Position: refs/heads/master@{#288479}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288479 0039d316-1c4b-4281-b951-d872f2087c98
parent 06f4eb15
...@@ -166,9 +166,9 @@ void PlatformFontMac::CalculateMetrics() { ...@@ -166,9 +166,9 @@ void PlatformFontMac::CalculateMetrics() {
base::scoped_nsobject<NSLayoutManager> layout_manager( base::scoped_nsobject<NSLayoutManager> layout_manager(
[[NSLayoutManager alloc] init]); [[NSLayoutManager alloc] init]);
height_ = [layout_manager defaultLineHeightForFont:font]; height_ = SkScalarCeilToInt([layout_manager defaultLineHeightForFont:font]);
ascent_ = [font ascender]; ascent_ = SkScalarCeilToInt([font ascender]);
cap_height_ = [font capHeight]; cap_height_ = SkScalarCeilToInt([font capHeight]);
average_width_ = average_width_ =
NSWidth([font boundingRectForGlyph:[font glyphWithName:@"x"]]); NSWidth([font boundingRectForGlyph:[font glyphWithName:@"x"]]);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment