| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 // Sets the description string for default FontList construction. If it's | 59 // Sets the description string for default FontList construction. If it's |
| 60 // empty, FontList will initialize using the default Font constructor. | 60 // empty, FontList will initialize using the default Font constructor. |
| 61 // | 61 // |
| 62 // The client code must call this function before any call of the default | 62 // The client code must call this function before any call of the default |
| 63 // constructor. This should be done on the UI thread. | 63 // constructor. This should be done on the UI thread. |
| 64 // | 64 // |
| 65 // ui::ResourceBundle may call this function more than once when UI language | 65 // ui::ResourceBundle may call this function more than once when UI language |
| 66 // is changed. | 66 // is changed. |
| 67 static void SetDefaultFontDescription(const std::string& font_description); | 67 static void SetDefaultFontDescription(const std::string& font_description); |
| 68 | 68 |
| 69 // Returns a new FontList with the given |font_style| flags. | |
| 70 FontList DeriveFontList(int font_style) const; | |
| 71 | |
| 72 // Returns a new FontList with the same font names and style but with the | |
| 73 // given font |size| in pixels. | |
| 74 FontList DeriveFontListWithSize(int size) const; | |
| 75 | |
| 76 // Returns a new FontList with the same font names and style but resized. | |
| 77 // |size_delta| is the size in pixels to add to the current font size. | |
| 78 FontList DeriveFontListWithSizeDelta(int size_delta) const; | |
| 79 | |
| 80 // Returns a new FontList with the same font names but resized and the given | 69 // Returns a new FontList with the same font names but resized and the given |
| 81 // style. |size_delta| is the size in pixels to add to the current font size. | 70 // style. |size_delta| is the size in pixels to add to the current font size. |
| 82 // |font_style| specifies the new style, which is a bitmask of the values: | 71 // |font_style| specifies the new style, which is a bitmask of the values: |
| 83 // Font::BOLD, Font::ITALIC and Font::UNDERLINE. | 72 // Font::BOLD, Font::ITALIC and Font::UNDERLINE. |
| 73 FontList Derive(int size_delta, int font_style) const; |
| 74 |
| 75 // Returns a new FontList with the same font names and style but resized. |
| 76 // |size_delta| is the size in pixels to add to the current font size. |
| 77 FontList DeriveWithSizeDelta(int size_delta) const; |
| 78 |
| 79 // Returns a new FontList with the same font names and size but the given |
| 80 // style. |font_style| specifies the new style, which is a bitmask of the |
| 81 // values: Font::BOLD, Font::ITALIC and Font::UNDERLINE. |
| 82 FontList DeriveWithStyle(int font_style) const; |
| 83 |
| 84 // Obsolete versions. Use the abolve methods instead. |
| 85 FontList DeriveFontListWithSizeDelta(int size_delta) const; |
| 84 FontList DeriveFontListWithSizeDeltaAndStyle(int size_delta, | 86 FontList DeriveFontListWithSizeDeltaAndStyle(int size_delta, |
| 85 int font_style) const; | 87 int font_style) const; |
| 86 | 88 |
| 87 // Returns the height of this font list, which is max(ascent) + max(descent) | 89 // Returns the height of this font list, which is max(ascent) + max(descent) |
| 88 // for all the fonts in the font list. | 90 // for all the fonts in the font list. |
| 89 int GetHeight() const; | 91 int GetHeight() const; |
| 90 | 92 |
| 91 // Returns the baseline of this font list, which is max(baseline) for all the | 93 // Returns the baseline of this font list, which is max(baseline) for all the |
| 92 // fonts in the font list. | 94 // fonts in the font list. |
| 93 int GetBaseline() const; | 95 int GetBaseline() const; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 mutable int common_baseline_; | 146 mutable int common_baseline_; |
| 145 | 147 |
| 146 // Cached font style and size. | 148 // Cached font style and size. |
| 147 mutable int font_style_; | 149 mutable int font_style_; |
| 148 mutable int font_size_; | 150 mutable int font_size_; |
| 149 }; | 151 }; |
| 150 | 152 |
| 151 } // namespace gfx | 153 } // namespace gfx |
| 152 | 154 |
| 153 #endif // UI_GFX_FONT_LIST_H_ | 155 #endif // UI_GFX_FONT_LIST_H_ |
| OLD | NEW |