Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(834)

Unified Diff: ui/gfx/font_list.cc

Issue 19666006: Supports FontList in Textfield. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removes ResourceBundle::Delegate::GetFontList. Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/gfx/font_list.cc
diff --git a/ui/gfx/font_list.cc b/ui/gfx/font_list.cc
index 3c1b0146cd57998cdc002e15dd58a3f54f146726..cb6cc9763de556591cf561610d23db741866fa8f 100644
--- a/ui/gfx/font_list.cc
+++ b/ui/gfx/font_list.cc
@@ -208,6 +208,18 @@ const std::string& FontList::GetFontDescriptionString() const {
return font_description_string_;
}
+int FontList::GetFontSize() const {
+ if (!fonts_.empty())
+ return fonts_[0].GetFontSize();
+
+ std::vector<std::string> font_names;
+ int font_style;
+ int font_size;
+ ParseFontDescriptionString(font_description_string_, &font_names,
+ &font_style, &font_size);
+ return font_size;
+}
+
const std::vector<Font>& FontList::GetFonts() const {
if (fonts_.empty()) {
DCHECK(!font_description_string_.empty());
@@ -230,4 +242,8 @@ const std::vector<Font>& FontList::GetFonts() const {
return fonts_;
}
+const Font& FontList::GetPrimaryFont() const {
+ return GetFonts()[0];
+}
+
} // namespace gfx

Powered by Google App Engine
This is Rietveld 408576698