Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_GFX_FONT_LIST_H_ | 5 #ifndef UI_GFX_FONT_LIST_H_ |
| 6 #define UI_GFX_FONT_LIST_H_ | 6 #define UI_GFX_FONT_LIST_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 | 110 |
| 111 // Returns the font size in pixels. | 111 // Returns the font size in pixels. |
| 112 int GetFontSize() const; | 112 int GetFontSize() const; |
| 113 | 113 |
| 114 // Returns the Font vector. | 114 // Returns the Font vector. |
| 115 const std::vector<Font>& GetFonts() const; | 115 const std::vector<Font>& GetFonts() const; |
| 116 | 116 |
| 117 // Returns the first font in the list. | 117 // Returns the first font in the list. |
| 118 const Font& GetPrimaryFont() const; | 118 const Font& GetPrimaryFont() const; |
| 119 | 119 |
| 120 // Given a containing |height| shrinks the font size until the font list | |
| 121 // will fit within |height| while having its cap height vertically centered. | |
| 122 // Returns the correctly-sized font list. | |
| 123 // | |
| 124 // 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
| |
| 125 // +--------+-----------------------------------------------+------------+ | |
| 126 // | | y offset | space | | |
| 127 // | +--------+-------------------+------------------+ above | | |
| 128 // | | | | internal leading | cap height | | |
| 129 // | box | font | ascent (baseline) +------------------+------------+ | |
| 130 // | height | height | | cap height | | |
| 131 // | | |-------------------+------------------+------------+ | |
| 132 // | | | descent (height - baseline) | space | | |
| 133 // | +--------+--------------------------------------+ below | | |
| 134 // | | space at bottom | cap height | | |
| 135 // +--------+-----------------------------------------------+------------+ | |
| 136 // Goal: | |
| 137 // center of box height == center of cap height | |
| 138 // (i.e. space above cap height == space below cap height) | |
| 139 // Restrictions: | |
| 140 // y offset >= 0 | |
| 141 // space at bottom >= 0 | |
| 142 // (i.e. Entire font must be visible inside the box.) | |
| 143 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.
| |
| 144 | |
| 120 private: | 145 private: |
| 121 explicit FontList(FontListImpl* impl); | 146 explicit FontList(FontListImpl* impl); |
| 122 | 147 |
| 123 static const scoped_refptr<FontListImpl>& GetDefaultImpl(); | 148 static const scoped_refptr<FontListImpl>& GetDefaultImpl(); |
| 124 | 149 |
| 125 scoped_refptr<FontListImpl> impl_; | 150 scoped_refptr<FontListImpl> impl_; |
| 126 }; | 151 }; |
| 127 | 152 |
| 128 } // namespace gfx | 153 } // namespace gfx |
| 129 | 154 |
| 130 #endif // UI_GFX_FONT_LIST_H_ | 155 #endif // UI_GFX_FONT_LIST_H_ |
| OLD | NEW |