| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_IMPL_H_ | 5 #ifndef UI_GFX_FONT_LIST_IMPL_H_ |
| 6 #define UI_GFX_FONT_LIST_IMPL_H_ | 6 #define UI_GFX_FONT_LIST_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 int GetCapHeight() const; | 63 int GetCapHeight() const; |
| 64 | 64 |
| 65 // Returns the expected number of horizontal pixels needed to display the | 65 // Returns the expected number of horizontal pixels needed to display the |
| 66 // specified length of characters. Call GetStringWidth() to retrieve the | 66 // specified length of characters. Call GetStringWidth() to retrieve the |
| 67 // actual number. | 67 // actual number. |
| 68 int GetExpectedTextWidth(int length) const; | 68 int GetExpectedTextWidth(int length) const; |
| 69 | 69 |
| 70 // Returns the |gfx::Font::FontStyle| style flags for this font list. | 70 // Returns the |gfx::Font::FontStyle| style flags for this font list. |
| 71 int GetFontStyle() const; | 71 int GetFontStyle() const; |
| 72 | 72 |
| 73 // Returns a string representing font names, styles, and size. If the | |
| 74 // FontListImpl is initialized by a vector of Font, use the first font's style | |
| 75 // and size for the description. | |
| 76 const std::string& GetFontDescriptionString() const; | |
| 77 | |
| 78 // Returns the font size in pixels. | 73 // Returns the font size in pixels. |
| 79 int GetFontSize() const; | 74 int GetFontSize() const; |
| 80 | 75 |
| 81 // Returns the Font vector. | 76 // Returns the Font vector. |
| 82 const std::vector<Font>& GetFonts() const; | 77 const std::vector<Font>& GetFonts() const; |
| 83 | 78 |
| 84 // Returns the first font in the list. | 79 // Returns the first font in the list. |
| 85 const Font& GetPrimaryFont() const; | 80 const Font& GetPrimaryFont() const; |
| 86 | 81 |
| 87 private: | 82 private: |
| (...skipping 12 matching lines...) Expand all Loading... |
| 100 // string, |fonts_| is not initialized during construction. Instead, it is | 95 // string, |fonts_| is not initialized during construction. Instead, it is |
| 101 // computed lazily when user asked to get the font vector. | 96 // computed lazily when user asked to get the font vector. |
| 102 mutable std::vector<Font> fonts_; | 97 mutable std::vector<Font> fonts_; |
| 103 | 98 |
| 104 // A string representing font names, styles, and sizes. | 99 // A string representing font names, styles, and sizes. |
| 105 // Please refer to the comments before class declaration for details on string | 100 // Please refer to the comments before class declaration for details on string |
| 106 // format. | 101 // format. |
| 107 // If FontListImpl is constructed with a vector of font, | 102 // If FontListImpl is constructed with a vector of font, |
| 108 // |font_description_string_| is not initialized during construction. Instead, | 103 // |font_description_string_| is not initialized during construction. Instead, |
| 109 // it is computed lazily when user asked to get the font description string. | 104 // it is computed lazily when user asked to get the font description string. |
| 105 // |
| 106 // TODO(derat): Remove laziness so that this can be removed. |
| 110 mutable std::string font_description_string_; | 107 mutable std::string font_description_string_; |
| 111 | 108 |
| 112 // The cached common height and baseline of the fonts in the font list. | 109 // The cached common height and baseline of the fonts in the font list. |
| 113 mutable int common_height_; | 110 mutable int common_height_; |
| 114 mutable int common_baseline_; | 111 mutable int common_baseline_; |
| 115 | 112 |
| 116 // Cached font style and size. | 113 // Cached font style and size. |
| 117 mutable int font_style_; | 114 mutable int font_style_; |
| 118 mutable int font_size_; | 115 mutable int font_size_; |
| 119 }; | 116 }; |
| 120 | 117 |
| 121 } // namespace gfx | 118 } // namespace gfx |
| 122 | 119 |
| 123 #endif // UI_GFX_FONT_LIST_IMPL_H_ | 120 #endif // UI_GFX_FONT_LIST_IMPL_H_ |
| OLD | NEW |