summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornkostylev@chromium.org <nkostylev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-22 20:57:18 +0000
committernkostylev@chromium.org <nkostylev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-22 20:57:18 +0000
commit068ea4cad37cf0cfd309f5dd5f9623a9c590ae35 (patch)
tree7957093405a846fa254a8f250b1a17646228dd8d
parent9b511537cfc34a2bda36f9298b270b1768c78e3a (diff)
downloadchromium_src-068ea4cad37cf0cfd309f5dd5f9623a9c590ae35.zip
chromium_src-068ea4cad37cf0cfd309f5dd5f9623a9c590ae35.tar.gz
chromium_src-068ea4cad37cf0cfd309f5dd5f9623a9c590ae35.tar.bz2
[cros] Adjust default font sizes for new hand hinted fonts.
BUG=chromium-os:8658 TEST=Manual. Review URL: http://codereview.chromium.org/5180002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66999 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--app/resource_bundle.cc24
-rw-r--r--build/build_config.h6
-rw-r--r--chrome/browser/chromeos/frame/bubble_frame_view.cc10
-rw-r--r--chrome/browser/chromeos/input_method/candidate_window.cc10
-rw-r--r--chrome/browser/chromeos/login/helper.h12
-rw-r--r--chrome/browser/chromeos/login/network_selection_view.cc3
-rw-r--r--chrome/browser/chromeos/login/user_controller.cc7
-rw-r--r--chrome/browser/chromeos/status/clock_menu_button.cc8
-rw-r--r--chrome/browser/chromeos/status/input_method_menu_button.cc8
-rw-r--r--chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc6
-rw-r--r--chrome/browser/ui/views/extensions/extension_install_prompt2.cc10
-rw-r--r--chrome/browser/ui/views/extensions/extension_installed_bubble.cc2
-rw-r--r--chrome/browser/ui/views/location_bar/location_bar_view.cc3
-rw-r--r--chrome/browser/ui/views/sad_tab_view.cc14
14 files changed, 97 insertions, 26 deletions
diff --git a/app/resource_bundle.cc b/app/resource_bundle.cc
index 859f9a83..ab34609 100644
--- a/app/resource_bundle.cc
+++ b/app/resource_bundle.cc
@@ -13,6 +13,21 @@
#include "gfx/font.h"
#include "third_party/skia/include/core/SkBitmap.h"
+namespace {
+
+// Font sizes relative to base font.
+#if defined(OS_CHROMEOS) && defined(CROS_FONTS_USING_BCI)
+const int kSmallFontSizeDelta = -3;
+const int kMediumFontSizeDelta = 2;
+const int kLargeFontSizeDelta = 7;
+#else
+const int kSmallFontSizeDelta = -2;
+const int kMediumFontSizeDelta = 3;
+const int kLargeFontSizeDelta = 8;
+#endif
+
+} // namespace
+
ResourceBundle* ResourceBundle::g_shared_instance_ = NULL;
/* static */
@@ -175,17 +190,18 @@ void ResourceBundle::LoadFontsIfNecessary() {
base_font_->DeriveFont(0, base_font_->GetStyle() | gfx::Font::BOLD);
small_font_.reset(new gfx::Font());
- *small_font_ = base_font_->DeriveFont(-2);
+ *small_font_ = base_font_->DeriveFont(kSmallFontSizeDelta);
medium_font_.reset(new gfx::Font());
- *medium_font_ = base_font_->DeriveFont(3);
+ *medium_font_ = base_font_->DeriveFont(kMediumFontSizeDelta);
medium_bold_font_.reset(new gfx::Font());
*medium_bold_font_ =
- base_font_->DeriveFont(3, base_font_->GetStyle() | gfx::Font::BOLD);
+ base_font_->DeriveFont(kMediumFontSizeDelta,
+ base_font_->GetStyle() | gfx::Font::BOLD);
large_font_.reset(new gfx::Font());
- *large_font_ = base_font_->DeriveFont(8);
+ *large_font_ = base_font_->DeriveFont(kLargeFontSizeDelta);
}
}
diff --git a/build/build_config.h b/build/build_config.h
index 3218a05..0bfccd7 100644
--- a/build/build_config.h
+++ b/build/build_config.h
@@ -127,4 +127,10 @@
#error Please add support for your compiler in build/build_config.h
#endif
+#if defined(OS_CHROMEOS)
+// Single define to trigger whether CrOS fonts have BCI on.
+// In that case font sizes/deltas should be adjusted.
+//define CROS_FONTS_USING_BCI
+#endif
+
#endif // BUILD_BUILD_CONFIG_H_
diff --git a/chrome/browser/chromeos/frame/bubble_frame_view.cc b/chrome/browser/chromeos/frame/bubble_frame_view.cc
index 9fe97c2..f185159 100644
--- a/chrome/browser/chromeos/frame/bubble_frame_view.cc
+++ b/chrome/browser/chromeos/frame/bubble_frame_view.cc
@@ -28,6 +28,13 @@ static const int kTitleTopPadding = 10;
static const int kTitleContentPadding = 10;
static const int kHorizontalPadding = 10;
+// Title font size correction.
+#if defined(CROS_FONTS_USING_BCI)
+static const int kTitleFontSizeDelta = 0;
+#else
+static const int kTitleFontSizeDelta = 1;
+#endif
+
} // namespace
namespace chromeos {
@@ -44,7 +51,8 @@ BubbleFrameView::BubbleFrameView(views::Window* frame,
if (frame_->GetDelegate()->ShouldShowWindowTitle()) {
title_ = new views::Label(frame_->GetDelegate()->GetWindowTitle());
title_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
- title_->SetFont(title_->font().DeriveFont(1, gfx::Font::BOLD));
+ title_->SetFont(title_->font().DeriveFont(kFontSizeCorrectionDelta,
+ gfx::Font::BOLD));
AddChildView(title_);
}
diff --git a/chrome/browser/chromeos/input_method/candidate_window.cc b/chrome/browser/chromeos/input_method/candidate_window.cc
index 5167629..5e5e723 100644
--- a/chrome/browser/chromeos/input_method/candidate_window.cc
+++ b/chrome/browser/chromeos/input_method/candidate_window.cc
@@ -46,7 +46,11 @@ const SkColor kAnnotationColor = SkColorSetRGB(0x88, 0x88, 0x88);
// We'll use a bigger font size, so Chinese characters are more readable
// in the candidate window.
-const int kFontSizeDelta = 2; // Two size bigger.
+#if defined(CROS_FONTS_USING_BCI)
+const int kFontSizeDelta = 1;
+#else
+const int kFontSizeDelta = 2;
+#endif
// The minimum width of candidate labels in the vertical candidate
// window. We use this value to prevent the candidate window from being
@@ -1264,8 +1268,8 @@ void CandidateWindowController::Impl::OnConnectionChange(
}
}
-CandidateWindowController::CandidateWindowController() :
- impl_(new CandidateWindowController::Impl) {
+CandidateWindowController::CandidateWindowController()
+ : impl_(new CandidateWindowController::Impl) {
}
CandidateWindowController::~CandidateWindowController() {
diff --git a/chrome/browser/chromeos/login/helper.h b/chrome/browser/chromeos/login/helper.h
index 71b3628..f10ef0a 100644
--- a/chrome/browser/chromeos/login/helper.h
+++ b/chrome/browser/chromeos/login/helper.h
@@ -42,7 +42,7 @@ views::Painter* CreateBackgroundPainter();
// |size| is not empty. Otherwise the whole monitor is occupied.
gfx::Rect CalculateScreenBounds(const gfx::Size& size);
-// Corrects font size for NativeButton control.
+// Corrects font size for Label control.
void CorrectLabelFontSize(views::Label* label);
// Corrects font size for MenuButton control.
@@ -110,8 +110,16 @@ class WideButton : public views::NativeButton {
} // namespace login
-// Font size correction in points for login/oobe textfields/buttons/title.
+// Font size correction in points for login/oobe controls.
+#if defined(CROS_FONTS_USING_BCI)
+const int kFontSizeCorrectionDelta = 1;
+const int kUnselectedUsernameFontDelta = 0;
+const int kWelcomeTitleFontDelta = 5;
+#else
const int kFontSizeCorrectionDelta = 2;
+const int kUnselectedUsernameFontDelta = 1;
+const int kWelcomeTitleFontDelta = 5;
+#endif
// New pod sizes.
const int kNewUserPodFullWidth = 372;
diff --git a/chrome/browser/chromeos/login/network_selection_view.cc b/chrome/browser/chromeos/login/network_selection_view.cc
index bc993b6..02e9026 100644
--- a/chrome/browser/chromeos/login/network_selection_view.cc
+++ b/chrome/browser/chromeos/login/network_selection_view.cc
@@ -60,9 +60,6 @@ const int kPaddingColumnWidth = 55;
const int kMediumPaddingColumnWidth = 20;
const int kControlPaddingRow = 15;
-// Size to add to the welcome title font.
-const int kWelcomeTitleFontDelta = 5;
-
// Fixed size for language/keyboard/network controls height.
const int kSelectionBoxHeight = 29;
diff --git a/chrome/browser/chromeos/login/user_controller.cc b/chrome/browser/chromeos/login/user_controller.cc
index 11b011e..661da5e 100644
--- a/chrome/browser/chromeos/login/user_controller.cc
+++ b/chrome/browser/chromeos/login/user_controller.cc
@@ -47,10 +47,11 @@ const int kUserNameGap = 4;
// Approximate height of controls window, this constant is used in new user
// case to make border window size close to existing users.
+#if defined(CROS_FONTS_USING_BCI)
+const int kControlsHeight = 31;
+#else
const int kControlsHeight = 28;
-
-// Delta for the unselected username font.
-const int kUnselectedUsernameFontDelta = 1;
+#endif
// Widget that notifies window manager about clicking on itself.
// Doesn't send anything if user is selected.
diff --git a/chrome/browser/chromeos/status/clock_menu_button.cc b/chrome/browser/chromeos/status/clock_menu_button.cc
index 447be43..93e44eb 100644
--- a/chrome/browser/chromeos/status/clock_menu_button.cc
+++ b/chrome/browser/chromeos/status/clock_menu_button.cc
@@ -25,6 +25,12 @@ namespace chromeos {
// when the timer goes off.
const int kTimerSlopSeconds = 1;
+#if defined(CROS_FONTS_USING_BCI)
+const int kFontSizeDelta = 0;
+#else
+const int kFontSizeDelta = 1;
+#endif
+
ClockMenuButton::ClockMenuButton(StatusAreaHost* host)
: StatusAreaButton(this),
host_(host) {
@@ -34,7 +40,7 @@ ClockMenuButton::ClockMenuButton(StatusAreaHost* host)
set_border(NULL);
set_use_menu_button_paint(true);
SetFont(ResourceBundle::GetSharedInstance().GetFont(
- ResourceBundle::BaseFont).DeriveFont(1));
+ ResourceBundle::BaseFont).DeriveFont(kFontSizeDelta));
SetEnabledColor(0xB3FFFFFF); // White with 70% Alpha
SetShowMultipleIconStates(false);
set_alignment(TextButton::ALIGN_CENTER);
diff --git a/chrome/browser/chromeos/status/input_method_menu_button.cc b/chrome/browser/chromeos/status/input_method_menu_button.cc
index cd99210..1fb5fa2 100644
--- a/chrome/browser/chromeos/status/input_method_menu_button.cc
+++ b/chrome/browser/chromeos/status/input_method_menu_button.cc
@@ -25,6 +25,12 @@ PrefService* GetPrefService(chromeos::StatusAreaHost* host) {
return NULL;
}
+#if defined(CROS_FONTS_USING_BCI)
+const int kFontSizeDelta = 0;
+#else
+const int kFontSizeDelta = 1;
+#endif
+
} // namespace
namespace chromeos {
@@ -42,7 +48,7 @@ InputMethodMenuButton::InputMethodMenuButton(StatusAreaHost* host)
set_border(NULL);
set_use_menu_button_paint(true);
SetFont(ResourceBundle::GetSharedInstance().GetFont(
- ResourceBundle::BaseFont).DeriveFont(1));
+ ResourceBundle::BaseFont).DeriveFont(kFontSizeDelta));
SetEnabledColor(0xB3FFFFFF); // White with 70% Alpha
SetDisabledColor(0x00FFFFFF); // White with 00% Alpha (invisible)
SetShowMultipleIconStates(false);
diff --git a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc
index 02e0a7a..2f808dd 100644
--- a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc
+++ b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc
@@ -121,11 +121,11 @@ const int kIconVerticalPadding = 2;
const int kTextVerticalPadding = 3;
// The size delta between the font used for the edit and the result rows. Passed
// to gfx::Font::DeriveFont.
-#if !defined(OS_CHROMEOS)
-const int kEditFontAdjust = -1;
-#else
+#if defined(OS_CHROMEOS) && !defined(CROS_FONTS_USING_BCI)
// Don't adjust font on chromeos as it becomes too small.
const int kEditFontAdjust = 0;
+#else
+const int kEditFontAdjust = -1;
#endif
// Horizontal padding between the buttons on the opt in promo.
diff --git a/chrome/browser/ui/views/extensions/extension_install_prompt2.cc b/chrome/browser/ui/views/extensions/extension_install_prompt2.cc
index c7ea367..6ee8285 100644
--- a/chrome/browser/ui/views/extensions/extension_install_prompt2.cc
+++ b/chrome/browser/ui/views/extensions/extension_install_prompt2.cc
@@ -50,6 +50,13 @@ const int kPermissionLabelWidth =
kPermissionBoxBorderWidth * 2 -
kPermissionBoxHorizontalPadding * 2;
+// Heading font size correction.
+#if defined(CROS_FONTS_USING_BCI)
+const int kHeadingFontSizeDelta = 0;
+#else
+const int kHeadingFontSizeDelta = 1;
+#endif
+
} // namespace
@@ -131,7 +138,8 @@ InstallDialogContent2::InstallDialogContent2(
heading_ = new views::Label(
l10n_util::GetStringF(IDS_EXTENSION_INSTALL_PROMPT_HEADING,
UTF8ToWide(extension->name())));
- heading_->SetFont(heading_->font().DeriveFont(1, gfx::Font::BOLD));
+ heading_->SetFont(heading_->font().DeriveFont(kHeadingFontSizeDelta,
+ gfx::Font::BOLD));
heading_->SetMultiLine(true);
heading_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
AddChildView(heading_);
diff --git a/chrome/browser/ui/views/extensions/extension_installed_bubble.cc b/chrome/browser/ui/views/extensions/extension_installed_bubble.cc
index e85e5376..d779197 100644
--- a/chrome/browser/ui/views/extensions/extension_installed_bubble.cc
+++ b/chrome/browser/ui/views/extensions/extension_installed_bubble.cc
@@ -85,7 +85,7 @@ class InstalledBubbleContent : public views::View,
heading_ = new views::Label(
l10n_util::GetStringF(IDS_EXTENSION_INSTALLED_HEADING,
UTF8ToWide(extension->name())));
- heading_->SetFont(font.DeriveFont(3, gfx::Font::NORMAL));
+ heading_->SetFont(rb.GetFont(ResourceBundle::MediumFont));
heading_->SetMultiLine(true);
heading_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
AddChildView(heading_);
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc
index 0b42f32..bfcb980 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -130,7 +130,8 @@ void LocationBarView::Init() {
ResourceBundle::BaseFont);
} else {
// Use a larger version of the system font.
- font_ = font_.DeriveFont(3);
+ font_ = ResourceBundle::GetSharedInstance().GetFont(
+ ResourceBundle::MediumFont);
}
// If this makes the font too big, try to make it smaller so it will fit.
diff --git a/chrome/browser/ui/views/sad_tab_view.cc b/chrome/browser/ui/views/sad_tab_view.cc
index 8849f4b..3af2197e 100644
--- a/chrome/browser/ui/views/sad_tab_view.cc
+++ b/chrome/browser/ui/views/sad_tab_view.cc
@@ -31,6 +31,15 @@ static const SkColor kLinkColor = SK_ColorWHITE;
static const SkColor kBackgroundColor = SkColorSetRGB(35, 48, 64);
static const SkColor kBackgroundEndColor = SkColorSetRGB(35, 48, 64);
+// Font size correction.
+#if defined(CROS_FONTS_USING_BCI)
+static const int kTitleFontSizeDelta = 1;
+static const int kMessageFontSizeDelta = 0;
+#else
+static const int kTitleFontSizeDelta = 2;
+static const int kMessageFontSizeDelta = 1;
+#endif
+
// static
SkBitmap* SadTabView::sad_tab_bitmap_ = NULL;
gfx::Font* SadTabView::title_font_ = NULL;
@@ -134,9 +143,10 @@ void SadTabView::InitClass() {
if (!initialized) {
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
title_font_ = new gfx::Font(
- rb.GetFont(ResourceBundle::BaseFont).DeriveFont(2, gfx::Font::BOLD));
+ rb.GetFont(ResourceBundle::BaseFont).DeriveFont(kTitleFontSizeDelta,
+ gfx::Font::BOLD));
message_font_ = new gfx::Font(
- rb.GetFont(ResourceBundle::BaseFont).DeriveFont(1));
+ rb.GetFont(ResourceBundle::BaseFont).DeriveFont(kMessageFontSizeDelta));
sad_tab_bitmap_ = rb.GetBitmapNamed(IDR_SAD_TAB);
title_ = l10n_util::GetString(IDS_SAD_TAB_TITLE);