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_LINUX_H_ | 5 #ifndef UI_GFX_PLATFORM_FONT_LINUX_H_ |
6 #define UI_GFX_PLATFORM_FONT_LINUX_H_ | 6 #define UI_GFX_PLATFORM_FONT_LINUX_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 std::string GetActualFontNameForTesting() const override; | 53 std::string GetActualFontNameForTesting() const override; |
54 int GetFontSize() const override; | 54 int GetFontSize() const override; |
55 const FontRenderParams& GetFontRenderParams() override; | 55 const FontRenderParams& GetFontRenderParams() override; |
56 | 56 |
57 private: | 57 private: |
58 // Create a new instance of this object with the specified properties. Called | 58 // Create a new instance of this object with the specified properties. Called |
59 // from DeriveFont. | 59 // from DeriveFont. |
60 PlatformFontLinux(sk_sp<SkTypeface> typeface, | 60 PlatformFontLinux(sk_sp<SkTypeface> typeface, |
61 const std::string& family, | 61 const std::string& family, |
62 int size_pixels, | 62 int size_pixels, |
63 bool italic, | 63 int style, |
64 Font::Weight weight, | 64 Font::Weight weight, |
65 const FontRenderParams& params); | 65 const FontRenderParams& params); |
66 ~PlatformFontLinux() override; | 66 ~PlatformFontLinux() override; |
67 | 67 |
68 // Initializes this object based on the passed-in details. If |typeface| is | 68 // Initializes this object based on the passed-in details. If |typeface| is |
69 // empty, a new typeface will be loaded. | 69 // empty, a new typeface will be loaded. |
70 void InitFromDetails( | 70 void InitFromDetails( |
71 sk_sp<SkTypeface> typeface, | 71 sk_sp<SkTypeface> typeface, |
72 const std::string& font_family, | 72 const std::string& font_family, |
73 int font_size_pixels, | 73 int font_size_pixels, |
74 bool italic, | 74 int style, |
75 Font::Weight weight, | 75 Font::Weight weight, |
76 const FontRenderParams& params); | 76 const FontRenderParams& params); |
77 | 77 |
78 // Initializes this object as a copy of another PlatformFontLinux. | 78 // Initializes this object as a copy of another PlatformFontLinux. |
79 void InitFromPlatformFont(const PlatformFontLinux* other); | 79 void InitFromPlatformFont(const PlatformFontLinux* other); |
80 | 80 |
81 // Computes the metrics if they have not yet been computed. | 81 // Computes the metrics if they have not yet been computed. |
82 void ComputeMetricsIfNecessary(); | 82 void ComputeMetricsIfNecessary(); |
83 | 83 |
84 sk_sp<SkTypeface> typeface_; | 84 sk_sp<SkTypeface> typeface_; |
85 | 85 |
86 // Additional information about the face. | 86 // Additional information about the face. |
87 // Skia actually expects a family name and not a font name. | 87 // Skia actually expects a family name and not a font name. |
88 std::string font_family_; | 88 std::string font_family_; |
89 int font_size_pixels_; | 89 int font_size_pixels_; |
90 bool italic_; | 90 int style_; |
91 float device_scale_factor_; | 91 float device_scale_factor_; |
92 | 92 |
93 // Information describing how the font should be rendered. | 93 // Information describing how the font should be rendered. |
94 FontRenderParams font_render_params_; | 94 FontRenderParams font_render_params_; |
95 | 95 |
96 // Cached metrics, generated on demand. | 96 // Cached metrics, generated on demand. |
97 bool metrics_need_computation_ = true; | 97 bool metrics_need_computation_ = true; |
98 int ascent_pixels_; | 98 int ascent_pixels_; |
99 int height_pixels_; | 99 int height_pixels_; |
100 int cap_height_pixels_; | 100 int cap_height_pixels_; |
101 double average_width_pixels_; | 101 double average_width_pixels_; |
102 Font::Weight weight_; | 102 Font::Weight weight_; |
103 | 103 |
104 #if defined(OS_CHROMEOS) | 104 #if defined(OS_CHROMEOS) |
105 // A font description string of the format used by FontList. | 105 // A font description string of the format used by FontList. |
106 static std::string* default_font_description_; | 106 static std::string* default_font_description_; |
107 #endif | 107 #endif |
108 | 108 |
109 DISALLOW_COPY_AND_ASSIGN(PlatformFontLinux); | 109 DISALLOW_COPY_AND_ASSIGN(PlatformFontLinux); |
110 }; | 110 }; |
111 | 111 |
112 } // namespace gfx | 112 } // namespace gfx |
113 | 113 |
114 #endif // UI_GFX_PLATFORM_FONT_LINUX_H_ | 114 #endif // UI_GFX_PLATFORM_FONT_LINUX_H_ |
OLD | NEW |