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_PANGO_H_ | 5 #ifndef UI_GFX_PLATFORM_FONT_PANGO_H_ |
6 #define UI_GFX_PLATFORM_FONT_PANGO_H_ | 6 #define UI_GFX_PLATFORM_FONT_PANGO_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 // Converts |gfx_font| to a new pango font. Free the returned font with | 28 // Converts |gfx_font| to a new pango font. Free the returned font with |
29 // pango_font_description_free(). | 29 // pango_font_description_free(). |
30 static PangoFontDescription* PangoFontFromGfxFont(const gfx::Font& gfx_font); | 30 static PangoFontDescription* PangoFontFromGfxFont(const gfx::Font& gfx_font); |
31 | 31 |
32 // Resets and reloads the cached system font used by the default constructor. | 32 // Resets and reloads the cached system font used by the default constructor. |
33 // This function is useful when the system font has changed, for example, when | 33 // This function is useful when the system font has changed, for example, when |
34 // the locale has changed. | 34 // the locale has changed. |
35 static void ReloadDefaultFont(); | 35 static void ReloadDefaultFont(); |
36 | 36 |
37 #if defined(OS_CHROMEOS) | 37 #if defined(OS_CHROMEOS) |
38 // Sets the default font. | 38 // Sets the default font. |font_description| is a Pango font description that |
| 39 // will be passed to pango_font_description_from_string(). |
39 static void SetDefaultFontDescription(const std::string& font_description); | 40 static void SetDefaultFontDescription(const std::string& font_description); |
40 #endif | 41 #endif |
41 | 42 |
42 // Position as an offset from the height of the drawn text, used to draw | 43 // Position as an offset from the height of the drawn text, used to draw |
43 // an underline. This is a negative number, so the underline would be | 44 // an underline. This is a negative number, so the underline would be |
44 // drawn at y + height + underline_position. | 45 // drawn at y + height + underline_position. |
45 double underline_position() const; | 46 double underline_position() const; |
46 // The thickness to draw the underline. | 47 // The thickness to draw the underline. |
47 double underline_thickness() const; | 48 double underline_thickness() const; |
48 | 49 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 // to compute them. | 114 // to compute them. |
114 bool pango_metrics_inited_; | 115 bool pango_metrics_inited_; |
115 double average_width_pixels_; | 116 double average_width_pixels_; |
116 double underline_position_pixels_; | 117 double underline_position_pixels_; |
117 double underline_thickness_pixels_; | 118 double underline_thickness_pixels_; |
118 | 119 |
119 // The default font, used for the default constructor. | 120 // The default font, used for the default constructor. |
120 static Font* default_font_; | 121 static Font* default_font_; |
121 | 122 |
122 #if defined(OS_CHROMEOS) | 123 #if defined(OS_CHROMEOS) |
| 124 // A Pango font description. |
123 static std::string* default_font_description_; | 125 static std::string* default_font_description_; |
124 #endif | 126 #endif |
125 | 127 |
126 DISALLOW_COPY_AND_ASSIGN(PlatformFontPango); | 128 DISALLOW_COPY_AND_ASSIGN(PlatformFontPango); |
127 }; | 129 }; |
128 | 130 |
129 } // namespace gfx | 131 } // namespace gfx |
130 | 132 |
131 #endif // UI_GFX_PLATFORM_FONT_PANGO_H_ | 133 #endif // UI_GFX_PLATFORM_FONT_PANGO_H_ |
OLD | NEW |