| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/gfx/platform_font_ios.h" | 5 #include "ui/gfx/platform_font_ios.h" |
| 6 | 6 |
| 7 #import <UIKit/UIKit.h> | 7 #import <UIKit/UIKit.h> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "ui/gfx/font.h" | 12 #include "ui/gfx/font.h" |
| 13 #include "ui/gfx/font_render_params.h" |
| 13 | 14 |
| 14 namespace gfx { | 15 namespace gfx { |
| 15 | 16 |
| 16 //////////////////////////////////////////////////////////////////////////////// | 17 //////////////////////////////////////////////////////////////////////////////// |
| 17 // PlatformFontIOS, public: | 18 // PlatformFontIOS, public: |
| 18 | 19 |
| 19 PlatformFontIOS::PlatformFontIOS() { | 20 PlatformFontIOS::PlatformFontIOS() { |
| 20 font_size_ = [UIFont systemFontSize]; | 21 font_size_ = [UIFont systemFontSize]; |
| 21 style_ = gfx::Font::NORMAL; | 22 style_ = gfx::Font::NORMAL; |
| 22 UIFont* system_font = [UIFont systemFontOfSize:font_size_]; | 23 UIFont* system_font = [UIFont systemFontOfSize:font_size_]; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 } | 69 } |
| 69 | 70 |
| 70 std::string PlatformFontIOS::GetActualFontNameForTesting() const { | 71 std::string PlatformFontIOS::GetActualFontNameForTesting() const { |
| 71 return base::SysNSStringToUTF8([GetNativeFont() familyName]); | 72 return base::SysNSStringToUTF8([GetNativeFont() familyName]); |
| 72 } | 73 } |
| 73 | 74 |
| 74 int PlatformFontIOS::GetFontSize() const { | 75 int PlatformFontIOS::GetFontSize() const { |
| 75 return font_size_; | 76 return font_size_; |
| 76 } | 77 } |
| 77 | 78 |
| 79 const FontRenderParams& PlatformFontIOS::GetFontRenderParams() const { |
| 80 NOTIMPLEMENTED(); |
| 81 static FontRenderParams params; |
| 82 return params; |
| 83 } |
| 84 |
| 78 NativeFont PlatformFontIOS::GetNativeFont() const { | 85 NativeFont PlatformFontIOS::GetNativeFont() const { |
| 79 return [UIFont fontWithName:base::SysUTF8ToNSString(font_name_) | 86 return [UIFont fontWithName:base::SysUTF8ToNSString(font_name_) |
| 80 size:font_size_]; | 87 size:font_size_]; |
| 81 } | 88 } |
| 82 | 89 |
| 83 //////////////////////////////////////////////////////////////////////////////// | 90 //////////////////////////////////////////////////////////////////////////////// |
| 84 // PlatformFontIOS, private: | 91 // PlatformFontIOS, private: |
| 85 | 92 |
| 86 PlatformFontIOS::PlatformFontIOS(const std::string& font_name, | 93 PlatformFontIOS::PlatformFontIOS(const std::string& font_name, |
| 87 int font_size, | 94 int font_size, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 return new PlatformFontIOS(native_font); | 126 return new PlatformFontIOS(native_font); |
| 120 } | 127 } |
| 121 | 128 |
| 122 // static | 129 // static |
| 123 PlatformFont* PlatformFont::CreateFromNameAndSize(const std::string& font_name, | 130 PlatformFont* PlatformFont::CreateFromNameAndSize(const std::string& font_name, |
| 124 int font_size) { | 131 int font_size) { |
| 125 return new PlatformFontIOS(font_name, font_size); | 132 return new PlatformFontIOS(font_name, font_size); |
| 126 } | 133 } |
| 127 | 134 |
| 128 } // namespace gfx | 135 } // namespace gfx |
| OLD | NEW |