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_FONT_LIST_H_ | 5 #ifndef UI_GFX_FONT_LIST_H_ |
6 #define UI_GFX_FONT_LIST_H_ | 6 #define UI_GFX_FONT_LIST_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 int GetBaseline() const; | 66 int GetBaseline() const; |
67 | 67 |
68 // Returns the |gfx::Font::FontStyle| style flags for this font list. | 68 // Returns the |gfx::Font::FontStyle| style flags for this font list. |
69 int GetFontStyle() const; | 69 int GetFontStyle() const; |
70 | 70 |
71 // Returns a string representing font names, styles, and size. If the FontList | 71 // Returns a string representing font names, styles, and size. If the FontList |
72 // is initialized by a vector of Font, use the first font's style and size | 72 // is initialized by a vector of Font, use the first font's style and size |
73 // for the description. | 73 // for the description. |
74 const std::string& GetFontDescriptionString() const; | 74 const std::string& GetFontDescriptionString() const; |
75 | 75 |
| 76 // Returns the font size in pixels. |
| 77 int GetFontSize() const; |
| 78 |
76 // Returns the Font vector. | 79 // Returns the Font vector. |
77 const std::vector<Font>& GetFonts() const; | 80 const std::vector<Font>& GetFonts() const; |
78 | 81 |
| 82 // Returns the first font in the list. |
| 83 const Font& GetPrimaryFont() const; |
| 84 |
79 private: | 85 private: |
80 // A vector of Font. If FontList is constructed with font description string, | 86 // A vector of Font. If FontList is constructed with font description string, |
81 // |fonts_| is not initialized during construction. Instead, it is computed | 87 // |fonts_| is not initialized during construction. Instead, it is computed |
82 // lazily when user asked to get the font vector. | 88 // lazily when user asked to get the font vector. |
83 mutable std::vector<Font> fonts_; | 89 mutable std::vector<Font> fonts_; |
84 | 90 |
85 // A string representing font names, styles, and sizes. | 91 // A string representing font names, styles, and sizes. |
86 // Please refer to the comments before class declaration for details on string | 92 // Please refer to the comments before class declaration for details on string |
87 // format. | 93 // format. |
88 // If FontList is constructed with a vector of font, | 94 // If FontList is constructed with a vector of font, |
89 // |font_description_string_| is not initialized during construction. Instead, | 95 // |font_description_string_| is not initialized during construction. Instead, |
90 // it is computed lazily when user asked to get the font description string. | 96 // it is computed lazily when user asked to get the font description string. |
91 mutable std::string font_description_string_; | 97 mutable std::string font_description_string_; |
92 | 98 |
93 // The cached common height and baseline of the fonts in the font list. | 99 // The cached common height and baseline of the fonts in the font list. |
94 mutable int common_height_; | 100 mutable int common_height_; |
95 mutable int common_baseline_; | 101 mutable int common_baseline_; |
96 }; | 102 }; |
97 | 103 |
98 } // namespace gfx | 104 } // namespace gfx |
99 | 105 |
100 #endif // UI_GFX_FONT_LIST_H_ | 106 #endif // UI_GFX_FONT_LIST_H_ |
OLD | NEW |