Chromium Code Reviews| 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 |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "ui/gfx/font.h" | 12 #include "ui/gfx/font.h" |
| 13 #include "ui/gfx/gfx_export.h" | 13 #include "ui/gfx/gfx_export.h" |
| 14 | 14 |
| 15 namespace gfx { | 15 namespace gfx { |
| 16 | 16 |
| 17 class FontListImpl; | 17 class FontListImpl; |
| 18 struct FontRenderParams; | |
| 18 | 19 |
| 19 // FontList represents a list of fonts and provides metrics which are common | 20 // FontList represents a list of fonts and provides metrics which are common |
| 20 // in the fonts. FontList is copyable and it's quite cheap to copy. | 21 // in the fonts. FontList is copyable and it's quite cheap to copy. |
| 21 // | 22 // |
| 22 // The format of font description string complies with that of Pango detailed at | 23 // The format of font description string complies with that of Pango detailed at |
| 23 // http://developer.gnome.org/pango/stable/pango-Fonts.html#pango-font-descripti on-from-string | 24 // http://developer.gnome.org/pango/stable/pango-Fonts.html#pango-font-descripti on-from-string |
| 24 // The format is "<FONT_FAMILY_LIST>,[STYLES] <SIZE>" where | 25 // The format is "<FONT_FAMILY_LIST>,[STYLES] <SIZE>" where |
| 25 // FONT_FAMILY_LIST is a comma-separated list of font family names, | 26 // FONT_FAMILY_LIST is a comma-separated list of font family names, |
| 26 // STYLES is a space-separated list of style names ("Bold" and "Italic"), | 27 // STYLES is a space-separated list of style names ("Bold" and "Italic"), |
| 27 // SIZE is a font size in pixel with the suffix "px". | 28 // SIZE is a font size in pixel with the suffix "px". |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 int GetFontStyle() const; | 105 int GetFontStyle() const; |
| 105 | 106 |
| 106 // Returns a string representing font names, styles, and size. If the FontList | 107 // Returns a string representing font names, styles, and size. If the FontList |
| 107 // is initialized by a vector of Font, use the first font's style and size | 108 // is initialized by a vector of Font, use the first font's style and size |
| 108 // for the description. | 109 // for the description. |
| 109 const std::string& GetFontDescriptionString() const; | 110 const std::string& GetFontDescriptionString() const; |
| 110 | 111 |
| 111 // Returns the font size in pixels. | 112 // Returns the font size in pixels. |
| 112 int GetFontSize() const; | 113 int GetFontSize() const; |
| 113 | 114 |
| 115 // Returns an object describing how the primary font should be rendered. | |
|
msw
2014/07/12 00:27:31
Can we avoid this? I'd rather users explicitly cal
Daniel Erat
2014/07/12 01:55:32
sure, i just did this to match the style of the re
msw
2014/07/12 02:26:40
Yeah, it's a gray area, but good to avoid non-obvi
| |
| 116 const FontRenderParams& GetFontRenderParams() const; | |
| 117 | |
| 114 // Returns the Font vector. | 118 // Returns the Font vector. |
| 115 const std::vector<Font>& GetFonts() const; | 119 const std::vector<Font>& GetFonts() const; |
| 116 | 120 |
| 117 // Returns the first font in the list. | 121 // Returns the first font in the list. |
| 118 const Font& GetPrimaryFont() const; | 122 const Font& GetPrimaryFont() const; |
| 119 | 123 |
| 120 private: | 124 private: |
| 121 explicit FontList(FontListImpl* impl); | 125 explicit FontList(FontListImpl* impl); |
| 122 | 126 |
| 123 static const scoped_refptr<FontListImpl>& GetDefaultImpl(); | 127 static const scoped_refptr<FontListImpl>& GetDefaultImpl(); |
| 124 | 128 |
| 125 scoped_refptr<FontListImpl> impl_; | 129 scoped_refptr<FontListImpl> impl_; |
| 126 }; | 130 }; |
| 127 | 131 |
| 128 } // namespace gfx | 132 } // namespace gfx |
| 129 | 133 |
| 130 #endif // UI_GFX_FONT_LIST_H_ | 134 #endif // UI_GFX_FONT_LIST_H_ |
| OLD | NEW |