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

Side by Side Diff: ui/gfx/font_list.h

Issue 24883002: Uses and returns the fractional width in text eliding (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More fixes per feedback plus new tests Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 int font_style) const; 74 int font_style) const;
75 75
76 // Returns the height of this font list, which is max(ascent) + max(descent) 76 // Returns the height of this font list, which is max(ascent) + max(descent)
77 // for all the fonts in the font list. 77 // for all the fonts in the font list.
78 int GetHeight() const; 78 int GetHeight() const;
79 79
80 // Returns the baseline of this font list, which is max(baseline) for all the 80 // Returns the baseline of this font list, which is max(baseline) for all the
81 // fonts in the font list. 81 // fonts in the font list.
82 int GetBaseline() const; 82 int GetBaseline() const;
83 83
84 // Returns the number of horizontal pixels needed to display |text|. 84 // Returns the pixel width needed to display |text|.
85 int GetStringWidth(const base::string16& text) const; 85 float GetStringWidth(const base::string16& text) const;
86 86
87 // Returns the expected number of horizontal pixels needed to display the 87 // Returns the expected pixel width needed to display the specified length of
88 // specified length of characters. Call GetStringWidth() to retrieve the 88 // characters. Call GetStringWidth() to retrieve the actual number.
89 // actual number. 89 float GetExpectedTextWidth(int length) const;
90 int GetExpectedTextWidth(int length) const;
91 90
92 // Returns the |gfx::Font::FontStyle| style flags for this font list. 91 // Returns the |gfx::Font::FontStyle| style flags for this font list.
93 int GetFontStyle() const; 92 int GetFontStyle() const;
94 93
95 // Returns a string representing font names, styles, and size. If the FontList 94 // Returns a string representing font names, styles, and size. If the FontList
96 // is initialized by a vector of Font, use the first font's style and size 95 // is initialized by a vector of Font, use the first font's style and size
97 // for the description. 96 // for the description.
98 const std::string& GetFontDescriptionString() const; 97 const std::string& GetFontDescriptionString() const;
99 98
100 // Returns the font size in pixels. 99 // Returns the font size in pixels.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 mutable int common_baseline_; 131 mutable int common_baseline_;
133 132
134 // Cached font style and size. 133 // Cached font style and size.
135 mutable int font_style_; 134 mutable int font_style_;
136 mutable int font_size_; 135 mutable int font_size_;
137 }; 136 };
138 137
139 } // namespace gfx 138 } // namespace gfx
140 139
141 #endif // UI_GFX_FONT_LIST_H_ 140 #endif // UI_GFX_FONT_LIST_H_
OLDNEW
« ui/gfx/font.h ('K') | « ui/gfx/font.cc ('k') | ui/gfx/font_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698