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 #ifndef UI_GFX_PLATFORM_FONT_IOS_H_ | 5 #ifndef UI_GFX_PLATFORM_FONT_IOS_H_ |
6 #define UI_GFX_PLATFORM_FONT_IOS_H_ | 6 #define UI_GFX_PLATFORM_FONT_IOS_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "ui/gfx/platform_font.h" | 9 #include "ui/gfx/platform_font.h" |
10 | 10 |
11 namespace gfx { | 11 namespace gfx { |
12 | 12 |
13 class PlatformFontIOS : public PlatformFont { | 13 class PlatformFontIOS : public PlatformFont { |
14 public: | 14 public: |
15 PlatformFontIOS(); | 15 PlatformFontIOS(); |
16 explicit PlatformFontIOS(NativeFont native_font); | 16 explicit PlatformFontIOS(NativeFont native_font); |
17 PlatformFontIOS(const std::string& font_name, | 17 PlatformFontIOS(const std::string& font_name, |
18 int font_size); | 18 int font_size); |
19 | 19 |
20 // Overridden from PlatformFont: | 20 // Overridden from PlatformFont: |
21 Font DeriveFont(int size_delta, int style) const override; | 21 Font DeriveFont(int size_delta, |
| 22 int style, |
| 23 gfx::Font::Weight weight) const override; |
22 int GetHeight() override; | 24 int GetHeight() override; |
| 25 gfx::Font::Weight GetWeight() const override; |
23 int GetBaseline() override; | 26 int GetBaseline() override; |
24 int GetCapHeight() override; | 27 int GetCapHeight() override; |
25 int GetExpectedTextWidth(int length) override; | 28 int GetExpectedTextWidth(int length) override; |
26 int GetStyle() const override; | 29 int GetStyle() const override; |
27 const std::string& GetFontName() const override; | 30 const std::string& GetFontName() const override; |
28 std::string GetActualFontNameForTesting() const override; | 31 std::string GetActualFontNameForTesting() const override; |
29 int GetFontSize() const override; | 32 int GetFontSize() const override; |
30 const FontRenderParams& GetFontRenderParams() override; | 33 const FontRenderParams& GetFontRenderParams() override; |
31 NativeFont GetNativeFont() const override; | 34 NativeFont GetNativeFont() const override; |
32 | 35 |
33 private: | 36 private: |
34 PlatformFontIOS(const std::string& font_name, int font_size, int style); | 37 PlatformFontIOS(const std::string& font_name, |
| 38 int font_size, |
| 39 int style, |
| 40 gfx::Font::Weight weight); |
35 ~PlatformFontIOS() override {} | 41 ~PlatformFontIOS() override {} |
36 | 42 |
37 // Initialize the object with the specified parameters. | 43 // Initialize the object with the specified parameters. |
38 void InitWithNameSizeAndStyle(const std::string& font_name, | 44 void InitWithNameSizeAndStyle(const std::string& font_name, |
39 int font_size, | 45 int font_size, |
40 int style); | 46 int style, |
| 47 gfx::Font::Weight weight); |
41 | 48 |
42 // Calculate and cache the font metrics. | 49 // Calculate and cache the font metrics. |
43 void CalculateMetrics(); | 50 void CalculateMetrics(); |
44 | 51 |
45 std::string font_name_; | 52 std::string font_name_; |
46 int font_size_; | 53 int font_size_; |
47 int style_; | 54 int style_; |
| 55 gfx::Font::Weight weight_; |
48 | 56 |
49 // Cached metrics, generated at construction. | 57 // Cached metrics, generated at construction. |
50 int height_; | 58 int height_; |
51 int ascent_; | 59 int ascent_; |
52 int cap_height_; | 60 int cap_height_; |
53 int average_width_; | 61 int average_width_; |
54 | 62 |
55 DISALLOW_COPY_AND_ASSIGN(PlatformFontIOS); | 63 DISALLOW_COPY_AND_ASSIGN(PlatformFontIOS); |
56 }; | 64 }; |
57 | 65 |
58 } // namespace gfx | 66 } // namespace gfx |
59 | 67 |
60 #endif // UI_GFX_PLATFORM_FONT_IOS_H_ | 68 #endif // UI_GFX_PLATFORM_FONT_IOS_H_ |
OLD | NEW |