| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 ~FontList(); | 51 ~FontList(); |
| 52 | 52 |
| 53 // Returns a new FontList with the given |font_style| flags. | 53 // Returns a new FontList with the given |font_style| flags. |
| 54 FontList DeriveFontList(int font_style) const; | 54 FontList DeriveFontList(int font_style) const; |
| 55 | 55 |
| 56 // Returns a new FontList with the same font names and style but with the | 56 // Returns a new FontList with the same font names and style but with the |
| 57 // given font |size| in pixels. | 57 // given font |size| in pixels. |
| 58 FontList DeriveFontListWithSize(int size) const; | 58 FontList DeriveFontListWithSize(int size) const; |
| 59 | 59 |
| 60 // Returns the height of this font list, which is max(ascent) + max(descent) |
| 61 // for all the fonts in the font list. |
| 62 int GetHeight() const; |
| 63 |
| 64 // Returns the baseline of this font list, which is max(baseline) for all the |
| 65 // fonts in the font list. |
| 66 int GetBaseline() const; |
| 67 |
| 60 // Returns the |gfx::Font::FontStyle| style flags for this font list. | 68 // Returns the |gfx::Font::FontStyle| style flags for this font list. |
| 61 int GetFontStyle() const; | 69 int GetFontStyle() const; |
| 62 | 70 |
| 63 // 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 |
| 64 // 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 |
| 65 // for the description. | 73 // for the description. |
| 66 const std::string& GetFontDescriptionString() const; | 74 const std::string& GetFontDescriptionString() const; |
| 67 | 75 |
| 68 // Returns the Font vector. | 76 // Returns the Font vector. |
| 69 const std::vector<Font>& GetFonts() const; | 77 const std::vector<Font>& GetFonts() const; |
| 70 | 78 |
| 71 private: | 79 private: |
| 72 // A vector of Font. If FontList is constructed with font description string, | 80 // A vector of Font. If FontList is constructed with font description string, |
| 73 // |fonts_| is not initialized during construction. Instead, it is computed | 81 // |fonts_| is not initialized during construction. Instead, it is computed |
| 74 // lazily when user asked to get the font vector. | 82 // lazily when user asked to get the font vector. |
| 75 mutable std::vector<Font> fonts_; | 83 mutable std::vector<Font> fonts_; |
| 76 | 84 |
| 77 // A string representing font names, styles, and sizes. | 85 // A string representing font names, styles, and sizes. |
| 78 // Please refer to the comments before class declaration for details on string | 86 // Please refer to the comments before class declaration for details on string |
| 79 // format. | 87 // format. |
| 80 // If FontList is constructed with a vector of font, | 88 // If FontList is constructed with a vector of font, |
| 81 // |font_description_string_| is not initialized during construction. Instead, | 89 // |font_description_string_| is not initialized during construction. Instead, |
| 82 // it is computed lazily when user asked to get the font description string. | 90 // it is computed lazily when user asked to get the font description string. |
| 83 mutable std::string font_description_string_; | 91 mutable std::string font_description_string_; |
| 92 |
| 93 // The cached common height and baseline of the fonts in the font list. |
| 94 mutable int common_height_; |
| 95 mutable int common_baseline_; |
| 84 }; | 96 }; |
| 85 | 97 |
| 86 } // namespace gfx | 98 } // namespace gfx |
| 87 | 99 |
| 88 #endif // UI_GFX_FONT_LIST_H_ | 100 #endif // UI_GFX_FONT_LIST_H_ |
| OLD | NEW |