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

Side by Side Diff: ui/gfx/font.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_H_ 5 #ifndef UI_GFX_FONT_H_
6 #define UI_GFX_FONT_H_ 6 #define UI_GFX_FONT_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 // Returns the number of vertical pixels needed to display characters from 62 // Returns the number of vertical pixels needed to display characters from
63 // the specified font. This may include some leading, i.e. height may be 63 // the specified font. This may include some leading, i.e. height may be
64 // greater than just ascent + descent. Specifically, the Windows and Mac 64 // greater than just ascent + descent. Specifically, the Windows and Mac
65 // implementations include leading and the Linux one does not. This may 65 // implementations include leading and the Linux one does not. This may
66 // need to be revisited in the future. 66 // need to be revisited in the future.
67 int GetHeight() const; 67 int GetHeight() const;
68 68
69 // Returns the baseline, or ascent, of the font. 69 // Returns the baseline, or ascent, of the font.
70 int GetBaseline() const; 70 int GetBaseline() const;
71 71
72 // Returns the average character width for the font. 72 // Returns the pixel width for the font.
msw 2013/10/01 19:14:53 nit: revert this comment change or update it to "/
jianli 2013/10/01 21:34:28 Done.
73 int GetAverageCharacterWidth() const; 73 float GetAverageCharacterWidth() const;
74 74
75 // Returns the number of horizontal pixels needed to display the specified 75 // Returns the pixel width needed to display the specified string.
76 // string. 76 float GetStringWidth(const base::string16& text) const;
77 int GetStringWidth(const base::string16& text) const;
78 77
79 // Returns the expected number of horizontal pixels needed to display the 78 // Returns the expected pixel width needed to display the specified length of
80 // specified length of characters. Call GetStringWidth() to retrieve the 79 // characters. Call GetStringWidth() to retrieve the actual number.
81 // actual number. 80 float GetExpectedTextWidth(int length) const;
82 int GetExpectedTextWidth(int length) const;
83 81
84 // Returns the style of the font. 82 // Returns the style of the font.
85 int GetStyle() const; 83 int GetStyle() const;
86 84
87 // Returns the font name in UTF-8. 85 // Returns the font name in UTF-8.
88 std::string GetFontName() const; 86 std::string GetFontName() const;
89 87
90 // Returns the font size in pixels. 88 // Returns the font size in pixels.
91 int GetFontSize() const; 89 int GetFontSize() const;
92 90
(...skipping 12 matching lines...) Expand all
105 PlatformFont* platform_font() const { return platform_font_.get(); } 103 PlatformFont* platform_font() const { return platform_font_.get(); }
106 104
107 private: 105 private:
108 // Wrapped platform font implementation. 106 // Wrapped platform font implementation.
109 scoped_refptr<PlatformFont> platform_font_; 107 scoped_refptr<PlatformFont> platform_font_;
110 }; 108 };
111 109
112 } // namespace gfx 110 } // namespace gfx
113 111
114 #endif // UI_GFX_FONT_H_ 112 #endif // UI_GFX_FONT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698