diff options
author | xji@chromium.org <xji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-19 04:09:01 +0000 |
---|---|---|
committer | xji@chromium.org <xji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-19 04:09:01 +0000 |
commit | 732ef6737ef6e1346255be7230032dcaf4e9ad03 (patch) | |
tree | c9663673eba42c9f33c413a909c16a37d7bd2ebb /ui/views/controls | |
parent | 963c1b96abd9baa3ccddb7bc59da8a93e0c2ae93 (diff) | |
download | chromium_src-732ef6737ef6e1346255be7230032dcaf4e9ad03.zip chromium_src-732ef6737ef6e1346255be7230032dcaf4e9ad03.tar.gz chromium_src-732ef6737ef6e1346255be7230032dcaf4e9ad03.tar.bz2 |
specify locale-dependent font list for UI on ChromeOS, so that those fonts have higher priority over the fallback fonts Pango picks up.
BUG=103860
TEST=build aura, start chromium in 'ar' locale. type in Arabic and check the Arabic text's shapes. remove IDS_UI_FONT_FAMILY_CROS from 'ar' resource file, build aura again, start chromium in 'ar', type in Arabic and the Arabic text's shapes should be different.
Review URL: http://codereview.chromium.org/8770034
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114953 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/controls')
-rw-r--r-- | ui/views/controls/textfield/native_textfield_views.cc | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/ui/views/controls/textfield/native_textfield_views.cc b/ui/views/controls/textfield/native_textfield_views.cc index 677c458..f5089d7 100644 --- a/ui/views/controls/textfield/native_textfield_views.cc +++ b/ui/views/controls/textfield/native_textfield_views.cc @@ -12,9 +12,11 @@ #include "base/logging.h" #include "base/message_loop.h" #include "base/utf_string_conversions.h" +#include "grit/app_locale_settings.h" #include "grit/ui_strings.h" #include "ui/base/clipboard/clipboard.h" #include "ui/base/dragdrop/drag_drop_types.h" +#include "ui/base/l10n/l10n_util.h" #include "ui/base/range/range.h" #include "ui/gfx/canvas.h" #include "ui/gfx/insets.h" @@ -77,9 +79,14 @@ NativeTextfieldViews::NativeTextfieldViews(Textfield* parent) // Lowercase is not supported. DCHECK_NE(parent->style(), Textfield::STYLE_LOWERCASE); +#if defined(OS_CHROMEOS) + GetRenderText()->SetFontList(gfx::FontList(l10n_util::GetStringUTF8( + IDS_UI_FONT_FAMILY_CROS))); +#else + GetRenderText()->SetFontList(gfx::FontList(textfield_->font())); +#endif // Set the default text style. gfx::StyleRange default_style; - default_style.font = textfield_->font(); default_style.foreground = textfield_->text_color(); GetRenderText()->set_default_style(default_style); GetRenderText()->ApplyDefaultStyle(); @@ -390,13 +397,12 @@ void NativeTextfieldViews::UpdateReadOnly() { } void NativeTextfieldViews::UpdateFont() { - // Update the default text style. - gfx::StyleRange default_style(GetRenderText()->default_style()); - default_style.font = textfield_->font(); - GetRenderText()->set_default_style(default_style); - GetRenderText()->ApplyDefaultStyle(); - +#if !defined(OS_CHROMEOS) + // For ChromeOS, we support a font list per locale, UpdateFont() should not + // take any effect. + GetRenderText()->SetFontList(gfx::FontList(textfield_->font())); OnCaretBoundsChanged(); +#endif } void NativeTextfieldViews::UpdateIsPassword() { |