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

Unified Diff: chrome/browser/ui/views/profiles/new_avatar_button.cc

Issue 470053004: [Win, Linux] Always display the avatar button text at the same size. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/profiles/new_avatar_button.cc
diff --git a/chrome/browser/ui/views/profiles/new_avatar_button.cc b/chrome/browser/ui/views/profiles/new_avatar_button.cc
index 99a62030508db329d3e8417a9fcc0b35cf0dbeee..eea2a1344814d2eda4a3075f17336b35d93a9321 100644
--- a/chrome/browser/ui/views/profiles/new_avatar_button.cc
+++ b/chrome/browser/ui/views/profiles/new_avatar_button.cc
@@ -18,6 +18,8 @@
namespace {
+const int kDisplayFontSize = 13;
+
scoped_ptr<views::Border> CreateBorder(const int normal_image_set[],
const int hot_image_set[],
const int pushed_image_set[]) {
@@ -59,6 +61,14 @@ NewAvatarButton::NewAvatarButton(
gfx::ShadowValue(gfx::Point(), 1.0f, SK_ColorDKGRAY)));
SetTextSubpixelRenderingEnabled(false);
+ // If the default font size is larger than the expected one, derive
+ // the correct font size to match it.
+ int font_size = GetFontList().GetFontSize();
+ if (font_size > kDisplayFontSize) {
+ SetFontList(GetFontList().DeriveWithSizeDelta(
msw 2014/08/25 19:17:20 I think we might need to use the font height inste
noms (inactive) 2014/08/25 19:19:36 I originally had the font height, but it didn't se
msw 2014/08/25 19:43:48 Unfortunately, what you had may have been "right".
noms (inactive) 2014/08/25 20:06:02 So what I had was: const int kDisplayFontSize =
msw 2014/08/25 20:13:51 No, you can't interchange font height and size val
+ kDisplayFontSize - font_size - 1));
+ }
+
ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance();
if (button_style == THEMED_BUTTON) {
const int kNormalImageSet[] = IMAGE_GRID(IDR_AVATAR_THEMED_BUTTON_NORMAL);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698