Chromium Code Reviews| Index: ui/gfx/platform_font_mac.mm |
| diff --git a/ui/gfx/platform_font_mac.mm b/ui/gfx/platform_font_mac.mm |
| index 1df9e6922196b6df791b3a67db9e676490783a2e..2e08a033aaf1c0d56f2ecffce10b9f5bc926c9af 100644 |
| --- a/ui/gfx/platform_font_mac.mm |
| +++ b/ui/gfx/platform_font_mac.mm |
| @@ -63,7 +63,7 @@ |
| : PlatformFontMac([NSFont systemFontOfSize:[NSFont systemFontSize]]) { |
| } |
| -PlatformFontMac::PlatformFontMac(NativeFont native_font) |
| +PlatformFontMac::PlatformFontMac(NativeFont native_font, bool underline) |
| : native_font_([native_font retain]), |
| font_name_(base::SysNSStringToUTF8([native_font_ familyName])), |
| font_size_([native_font_ pointSize]), |
| @@ -72,6 +72,8 @@ |
| NSFontSymbolicTraits traits = [[native_font fontDescriptor] symbolicTraits]; |
| if (traits & NSFontItalicTrait) |
| font_style_ |= Font::ITALIC; |
| + if (underline) |
| + font_style_ |= Font::UNDERLINE; |
| if (traits & NSFontBoldTrait) |
| font_weight_ = Font::Weight::BOLD; |
| @@ -79,16 +81,10 @@ |
| } |
| PlatformFontMac::PlatformFontMac(const std::string& font_name, int font_size) |
| - : native_font_([NSFontWithSpec(font_name, |
| - font_size, |
| - Font::NORMAL, |
| - Font::Weight::NORMAL) retain]), |
| - font_name_(font_name), |
| - font_size_(font_size), |
| - font_style_(Font::NORMAL), |
| - font_weight_(Font::Weight::NORMAL) { |
| - CalculateMetricsAndInitRenderParams(); |
| -} |
| + : PlatformFontMac(font_name, |
|
karandeepb
2016/08/05 11:03:07
Just a small cleanup.
Avi (use Gerrit)
2016/08/05 14:54:59
Acknowledged.
|
| + font_size, |
| + Font::NORMAL, |
| + Font::Weight::NORMAL) {} |
| //////////////////////////////////////////////////////////////////////////////// |
| // PlatformFontMac, PlatformFont implementation: |
| @@ -98,10 +94,12 @@ |
| Font::Weight weight) const { |
| if (native_font_ && style == font_style_ && weight == font_weight_) { |
| // System fonts have special attributes starting with 10.11. They should be |
| - // requested using the same descriptor to preserve these attributes. |
| - return Font(new PlatformFontMac([NSFont |
| - fontWithDescriptor:[native_font_ fontDescriptor] |
| - size:font_size_ + size_delta])); |
| + // requested using the same descriptor to preserve these attributes. Since |
| + // NSFont does not support underline as a descriptor, pass it explicitly. |
| + return Font(new PlatformFontMac( |
| + [NSFont fontWithDescriptor:[native_font_ fontDescriptor] |
| + size:font_size_ + size_delta], |
| + style & Font::UNDERLINE)); |
| } |
| return Font( |