diff options
author | yukishiino@chromium.org <yukishiino@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-01 17:01:50 +0000 |
---|---|---|
committer | yukishiino@chromium.org <yukishiino@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-01 17:01:50 +0000 |
commit | 7682076160467ecef5f3e788006036f834df5b7d (patch) | |
tree | 30511a8e648f475ff1e6258b735872004d84c91b /ui/gfx/font_list.cc | |
parent | 2a684221ee7fe5a83b0c51e87424ad9f3828b2bc (diff) | |
download | chromium_src-7682076160467ecef5f3e788006036f834df5b7d.zip chromium_src-7682076160467ecef5f3e788006036f834df5b7d.tar.gz chromium_src-7682076160467ecef5f3e788006036f834df5b7d.tar.bz2 |
Supports FontList in Textfield.
The current interface of Textfield does not support FontList while RenderText supports FontList. This CL supports FontList in Textfield.
The direct cause of crbug.com/263169 was that RenderText always uses the IDS_UI_FONT_FAMILY_CROS font set ignoring what font is specified for Textfield on ChromeOS. (See https://code.google.com/p/chromium/codesearch#chromium/src/ui/views/controls/textfield/native_textfield_views.cc&q=IDS_UI_FONT_FAMILY_CROS&sq=package:chromium&type=cs&l=88 )
The Omnibox font size is carefully calculated, but the font is ignored right now.
This CL changes the following:
- Supports FontList in Textfield so Omnibox layer can specify the font set, such as IDS_UI_FONT_FAMILY_CROS, for the underlying Textfield.
- Makes NativeTextfieldViews follow the specified font set via Textfield on ChromeOS.
BUG=263169,263196
TEST=Test manually.
Review URL: https://chromiumcodereview.appspot.com/19666006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@215055 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/font_list.cc')
-rw-r--r-- | ui/gfx/font_list.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/ui/gfx/font_list.cc b/ui/gfx/font_list.cc index 3c1b014..cb6cc97 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 |