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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 vector. | 76 // Returns the Font vector. |
77 const std::vector<Font>& GetFonts() const; | 77 const std::vector<Font>& GetFonts() const; |
78 | 78 |
79 // Returns the first font in the list. | |
80 const Font& GetPrimaryFont() const { return GetFonts()[0]; } | |
Alexei Svitkine (slow)
2013/07/25 14:55:12
This shouldn't be defined inline.
Yuki
2013/07/25 15:07:42
Done.
| |
81 | |
79 private: | 82 private: |
80 // A vector of Font. If FontList is constructed with font description string, | 83 // A vector of Font. If FontList is constructed with font description string, |
81 // |fonts_| is not initialized during construction. Instead, it is computed | 84 // |fonts_| is not initialized during construction. Instead, it is computed |
82 // lazily when user asked to get the font vector. | 85 // lazily when user asked to get the font vector. |
83 mutable std::vector<Font> fonts_; | 86 mutable std::vector<Font> fonts_; |
84 | 87 |
85 // A string representing font names, styles, and sizes. | 88 // A string representing font names, styles, and sizes. |
86 // Please refer to the comments before class declaration for details on string | 89 // Please refer to the comments before class declaration for details on string |
87 // format. | 90 // format. |
88 // If FontList is constructed with a vector of font, | 91 // If FontList is constructed with a vector of font, |
89 // |font_description_string_| is not initialized during construction. Instead, | 92 // |font_description_string_| is not initialized during construction. Instead, |
90 // it is computed lazily when user asked to get the font description string. | 93 // it is computed lazily when user asked to get the font description string. |
91 mutable std::string font_description_string_; | 94 mutable std::string font_description_string_; |
92 | 95 |
93 // The cached common height and baseline of the fonts in the font list. | 96 // The cached common height and baseline of the fonts in the font list. |
94 mutable int common_height_; | 97 mutable int common_height_; |
95 mutable int common_baseline_; | 98 mutable int common_baseline_; |
96 }; | 99 }; |
97 | 100 |
98 } // namespace gfx | 101 } // namespace gfx |
99 | 102 |
100 #endif // UI_GFX_FONT_LIST_H_ | 103 #endif // UI_GFX_FONT_LIST_H_ |
OLD | NEW |