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

Side by Side Diff: ui/gfx/platform_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_PLATFORM_FONT_H_ 5 #ifndef UI_GFX_PLATFORM_FONT_H_
6 #define UI_GFX_PLATFORM_FONT_H_ 6 #define UI_GFX_PLATFORM_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 24 matching lines...) Expand all
35 // Returns the number of vertical pixels needed to display characters from 35 // Returns the number of vertical pixels needed to display characters from
36 // the specified font. This may include some leading, i.e. height may be 36 // the specified font. This may include some leading, i.e. height may be
37 // greater than just ascent + descent. Specifically, the Windows and Mac 37 // greater than just ascent + descent. Specifically, the Windows and Mac
38 // implementations include leading and the Linux one does not. This may 38 // implementations include leading and the Linux one does not. This may
39 // need to be revisited in the future. 39 // need to be revisited in the future.
40 virtual int GetHeight() const = 0; 40 virtual int GetHeight() const = 0;
41 41
42 // Returns the baseline, or ascent, of the font. 42 // Returns the baseline, or ascent, of the font.
43 virtual int GetBaseline() const = 0; 43 virtual int GetBaseline() const = 0;
44 44
45 // Returns the average character width for the font. 45 // Returns the pixel width for the font.
46 virtual int GetAverageCharacterWidth() const = 0; 46 virtual float GetAverageCharacterWidth() const = 0;
47 47
48 // Returns the number of horizontal pixels needed to display the specified 48 // Returns the pixel width needed to display the specified string.
49 // string. 49 virtual float GetStringWidth(const base::string16& text) const = 0;
50 virtual int GetStringWidth(const base::string16& text) const = 0;
51 50
52 // Returns the expected number of horizontal pixels needed to display the 51 // Returns the expected pixel width needed to display the specified length of
53 // specified length of characters. Call GetStringWidth() to retrieve the 52 // characters. Call GetStringWidth() to retrieve the actual number.
54 // actual number. 53 virtual float GetExpectedTextWidth(int length) const = 0;
55 virtual int GetExpectedTextWidth(int length) const = 0;
56 54
57 // Returns the style of the font. 55 // Returns the style of the font.
58 virtual int GetStyle() const = 0; 56 virtual int GetStyle() const = 0;
59 57
60 // Returns the font name in UTF-8. 58 // Returns the font name in UTF-8.
61 virtual std::string GetFontName() const = 0; 59 virtual std::string GetFontName() const = 0;
62 60
63 // Returns the font size in pixels. 61 // Returns the font size in pixels.
64 virtual int GetFontSize() const = 0; 62 virtual int GetFontSize() const = 0;
65 63
66 // Returns the native font handle. 64 // Returns the native font handle.
67 virtual NativeFont GetNativeFont() const = 0; 65 virtual NativeFont GetNativeFont() const = 0;
68 66
69 protected: 67 protected:
70 virtual ~PlatformFont() {} 68 virtual ~PlatformFont() {}
71 69
72 private: 70 private:
73 friend class base::RefCounted<PlatformFont>; 71 friend class base::RefCounted<PlatformFont>;
74 }; 72 };
75 73
76 } // namespace gfx 74 } // namespace gfx
77 75
78 #endif // UI_GFX_PLATFORM_FONT_H_ 76 #endif // UI_GFX_PLATFORM_FONT_H_
79 77
OLDNEW
« ui/gfx/font.h ('K') | « ui/gfx/font_unittest.cc ('k') | ui/gfx/platform_font_ios.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698