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" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 } | 69 } |
70 | 70 |
71 int PlatformFontIOS::GetStyle() const { | 71 int PlatformFontIOS::GetStyle() const { |
72 return style_; | 72 return style_; |
73 } | 73 } |
74 | 74 |
75 std::string PlatformFontIOS::GetFontName() const { | 75 std::string PlatformFontIOS::GetFontName() const { |
76 return font_name_; | 76 return font_name_; |
77 } | 77 } |
78 | 78 |
| 79 std::string PlatformFontIOS::GetActualFontNameForTesting() const { |
| 80 return base::SysNSStringToUTF8([GetNativeFont() familyName]); |
| 81 } |
| 82 |
79 int PlatformFontIOS::GetFontSize() const { | 83 int PlatformFontIOS::GetFontSize() const { |
80 return font_size_; | 84 return font_size_; |
81 } | 85 } |
82 | 86 |
83 NativeFont PlatformFontIOS::GetNativeFont() const { | 87 NativeFont PlatformFontIOS::GetNativeFont() const { |
84 return [UIFont fontWithName:base::SysUTF8ToNSString(font_name_) | 88 return [UIFont fontWithName:base::SysUTF8ToNSString(font_name_) |
85 size:font_size_]; | 89 size:font_size_]; |
86 } | 90 } |
87 | 91 |
88 //////////////////////////////////////////////////////////////////////////////// | 92 //////////////////////////////////////////////////////////////////////////////// |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 return new PlatformFontIOS(native_font); | 128 return new PlatformFontIOS(native_font); |
125 } | 129 } |
126 | 130 |
127 // static | 131 // static |
128 PlatformFont* PlatformFont::CreateFromNameAndSize(const std::string& font_name, | 132 PlatformFont* PlatformFont::CreateFromNameAndSize(const std::string& font_name, |
129 int font_size) { | 133 int font_size) { |
130 return new PlatformFontIOS(font_name, font_size); | 134 return new PlatformFontIOS(font_name, font_size); |
131 } | 135 } |
132 | 136 |
133 } // namespace gfx | 137 } // namespace gfx |
OLD | NEW |