OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 APP_GFX_FONT_H_ | 5 #ifndef APP_GFX_FONT_H_ |
6 #define APP_GFX_FONT_H_ | 6 #define APP_GFX_FONT_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 // the specified length of characters. | 90 // the specified length of characters. |
91 // Call GetStringWidth() to retrieve the actual number. | 91 // Call GetStringWidth() to retrieve the actual number. |
92 int GetExpectedTextWidth(int length) const; | 92 int GetExpectedTextWidth(int length) const; |
93 | 93 |
94 // Returns the style of the font. | 94 // Returns the style of the font. |
95 int style() const; | 95 int style() const; |
96 | 96 |
97 // Font Name. | 97 // Font Name. |
98 // It is actually a font family name, because Skia expects a family name | 98 // It is actually a font family name, because Skia expects a family name |
99 // and not a font name. | 99 // and not a font name. |
100 std::wstring FontName(); | 100 const std::wstring& FontName() const; |
101 | 101 |
102 // Font Size. | 102 // Font Size. |
103 int FontSize(); | 103 int FontSize(); |
104 | 104 |
105 NativeFont nativeFont() const; | 105 NativeFont nativeFont() const; |
106 | 106 |
107 // Creates a font with the default name and style. | 107 // Creates a font with the default name and style. |
108 Font(); | 108 Font(); |
109 | 109 |
110 #if defined(OS_WIN) | 110 #if defined(OS_WIN) |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 int dlu_base_x); | 168 int dlu_base_x); |
169 ~HFontRef(); | 169 ~HFontRef(); |
170 | 170 |
171 // Accessors | 171 // Accessors |
172 HFONT hfont() const { return hfont_; } | 172 HFONT hfont() const { return hfont_; } |
173 int height() const { return height_; } | 173 int height() const { return height_; } |
174 int baseline() const { return baseline_; } | 174 int baseline() const { return baseline_; } |
175 int ave_char_width() const { return ave_char_width_; } | 175 int ave_char_width() const { return ave_char_width_; } |
176 int style() const { return style_; } | 176 int style() const { return style_; } |
177 int dlu_base_x() const { return dlu_base_x_; } | 177 int dlu_base_x() const { return dlu_base_x_; } |
| 178 const std::wstring& font_name() const { return font_name_; } |
178 | 179 |
179 private: | 180 private: |
180 const HFONT hfont_; | 181 const HFONT hfont_; |
181 const int height_; | 182 const int height_; |
182 const int baseline_; | 183 const int baseline_; |
183 const int ave_char_width_; | 184 const int ave_char_width_; |
184 const int style_; | 185 const int style_; |
185 // Constants used in converting dialog units to pixels. | 186 // Constants used in converting dialog units to pixels. |
186 const int dlu_base_x_; | 187 const int dlu_base_x_; |
| 188 const std::wstring font_name_; |
187 | 189 |
188 DISALLOW_COPY_AND_ASSIGN(HFontRef); | 190 DISALLOW_COPY_AND_ASSIGN(HFontRef); |
189 }; | 191 }; |
190 | 192 |
191 // Returns the base font ref. This should ONLY be invoked on the | 193 // Returns the base font ref. This should ONLY be invoked on the |
192 // UI thread. | 194 // UI thread. |
193 static HFontRef* GetBaseFontRef(); | 195 static HFontRef* GetBaseFontRef(); |
194 | 196 |
195 // Creates and returns a new HFONTRef from the specified HFONT. | 197 // Creates and returns a new HFONTRef from the specified HFONT. |
196 static HFontRef* CreateHFontRef(HFONT font); | 198 static HFontRef* CreateHFontRef(HFONT font); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 int height_; | 257 int height_; |
256 int ascent_; | 258 int ascent_; |
257 int avg_width_; | 259 int avg_width_; |
258 #endif | 260 #endif |
259 | 261 |
260 }; | 262 }; |
261 | 263 |
262 } // namespace gfx | 264 } // namespace gfx |
263 | 265 |
264 #endif // APP_GFX_FONT_H_ | 266 #endif // APP_GFX_FONT_H_ |
OLD | NEW |