diff options
author | xji@chromium.org <xji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-24 06:14:07 +0000 |
---|---|---|
committer | xji@chromium.org <xji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-24 06:14:07 +0000 |
commit | fdf481ba49097edcfe9ace5888a263ab2fb437d6 (patch) | |
tree | ce98020146bd69b6f7271ed37c3ad09ff8af1010 /ui/gfx/font_list.cc | |
parent | 9cde7cbcd0052d7bf33d7ef4e6386360d53a83c0 (diff) | |
download | chromium_src-fdf481ba49097edcfe9ace5888a263ab2fb437d6.zip chromium_src-fdf481ba49097edcfe9ace5888a263ab2fb437d6.tar.gz chromium_src-fdf481ba49097edcfe9ace5888a263ab2fb437d6.tar.bz2 |
Aura: apply UI font list to cros.
- change IDS_UI_FONT_FAMILY_CROS back to 12px in default.
- GetDefaultFont() in platform_font_pango.cc returns IDS_UI_FONT_FAMILY_CROS for Aura Chrome OS.
- views::NativeTextfieldViews::UpdateFont() applies the size from the passed-in font on Chrome OS
- OmniboxViewViews requests a larger font size.
- Correspondingly, decrease OmniboxViewViews's vertical margin so that the display area has greater height to accommodate larger font size.
BUG=103860, 109961
TEST=visual on omnibox and popup, bookmark bubble, findbar, and omnibox in popup.
Review URL: http://codereview.chromium.org/9192018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118802 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/font_list.cc')
-rw-r--r-- | ui/gfx/font_list.cc | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/ui/gfx/font_list.cc b/ui/gfx/font_list.cc index 24bfde2..dc42c2f 100644 --- a/ui/gfx/font_list.cc +++ b/ui/gfx/font_list.cc @@ -57,6 +57,15 @@ std::string FontStyleAndSizeToString(int font_style, int font_size) { return result; } +// Returns font description from |font_names|, |font_style|, and |font_size|. +std::string BuildFontDescription(const std::vector<std::string>& font_names, + int font_style, + int font_size) { + std::string description = JoinString(font_names, ','); + description += "," + FontStyleAndSizeToString(font_style, font_size); + return description; +} + } // namespace namespace gfx { @@ -107,9 +116,35 @@ FontList FontList::DeriveFontList(int font_style) const { int font_size; ParseFontDescriptionString(font_description_string_, &font_names, &old_style, &font_size); - std::string description = JoinString(font_names, ','); - description += "," + FontStyleAndSizeToString(font_style, font_size); - return FontList(description); + return FontList(BuildFontDescription(font_names, font_style, font_size)); +} + +FontList FontList::DeriveFontListWithSize(int size) const { + DCHECK_GT(size, 0); + + // If there is a font vector, derive from that. + int old_size = 0; + if (!fonts_.empty()) { + old_size = fonts_[0].GetFontSize(); + if (old_size == size) + return FontList(fonts_); + + std::vector<Font> fonts = fonts_; + for (size_t i = 0; i < fonts.size(); ++i) + fonts[i] = fonts[i].DeriveFont(size - old_size); + return FontList(fonts); + } + + // Otherwise, parse the font description string to derive from it. + std::vector<std::string> font_names; + int font_style = 0; + ParseFontDescriptionString(font_description_string_, &font_names, + &font_style, &old_size); + + if (old_size == size) + return FontList(font_description_string_); + + return FontList(BuildFontDescription(font_names, font_style, size)); } int FontList::GetFontStyle() const { |