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

Unified Diff: ui/gfx/font_list.h

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: rebase + review comments and moar better test 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
Index: ui/gfx/font_list.h
diff --git a/ui/gfx/font_list.h b/ui/gfx/font_list.h
index 1ba8ad1aff9f0511bcf3c17421f15655766e14f1..6db0287b947e4e83537e610b30a81d2331c3c561 100644
--- a/ui/gfx/font_list.h
+++ b/ui/gfx/font_list.h
@@ -83,6 +83,31 @@ class GFX_EXPORT FontList {
// values: Font::BOLD, Font::ITALIC and Font::UNDERLINE.
FontList DeriveWithStyle(int font_style) const;
+ // Given a containing |height| shrinks the font size until the font list
msw 2014/08/29 17:25:59 nit: Remove "Given a containing |height| "
noms (inactive) 2014/08/29 18:03:20 Done. Did some minor rewording to match the other
+ // will fit within |height| while having its cap height vertically centered.
+ // Returns the correctly-sized font list.
+ //
+ // The expected layout:
+ // +--------+-----------------------------------------------+------------+
+ // | | y offset | space |
+ // | +--------+-------------------+------------------+ above |
+ // | | | | internal leading | cap height |
+ // | box | font | ascent (baseline) +------------------+------------+
+ // | height | height | | cap height |
+ // | | |-------------------+------------------+------------+
+ // | | | descent (height - baseline) | space |
+ // | +--------+--------------------------------------+ below |
+ // | | space at bottom | cap height |
+ // +--------+-----------------------------------------------+------------+
+ // Goal:
+ // center of box height == center of cap height
+ // (i.e. space above cap height == space below cap height)
+ // Restrictions:
+ // y offset >= 0
+ // space at bottom >= 0
+ // (i.e. Entire font must be visible inside the box.)
+ gfx::FontList DeriveWithHeightUpperBound(int height) const;
+
// Returns the height of this font list, which is max(ascent) + max(descent)
// for all the fonts in the font list.
int GetHeight() const;

Powered by Google App Engine
This is Rietveld 408576698