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

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: maybe made test better? 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..4762216d4aac7d020a9b2871bfde60786840a985 100644
--- a/ui/gfx/font_list.h
+++ b/ui/gfx/font_list.h
@@ -117,6 +117,31 @@ class GFX_EXPORT FontList {
// Returns the first font in the list.
const Font& GetPrimaryFont() const;
+ // Given a containing |height| shrinks the font size until the font list
+ // will fit within |height| while having its cap height vertically centered.
+ // Returns the correctly-sized font list.
+ //
+ // The expected layout:
msw 2014/08/28 21:43:50 Perhaps the expected layout comment belongs in the
Peter Kasting 2014/08/28 21:52:03 I think the comment should either be left here or
+ // +--------+-----------------------------------------------+------------+
+ // | | 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;
msw 2014/08/28 21:43:50 Reorder this (and the impl) with the other derive
noms (inactive) 2014/08/29 17:10:29 Done.
+
private:
explicit FontList(FontListImpl* impl);

Powered by Google App Engine
This is Rietveld 408576698