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

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

Issue 8392017: Change string16 to std::string in the gfx::Font() interface. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add 'UTF-8' everywhere in the comments Created 9 years, 1 month 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
« no previous file with comments | « printing/print_settings_initializer.cc ('k') | ui/gfx/font.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 25 matching lines...) Expand all
36 Font(const Font& other); 36 Font(const Font& other);
37 gfx::Font& operator=(const Font& other); 37 gfx::Font& operator=(const Font& other);
38 38
39 // Creates a font from the specified native font. 39 // Creates a font from the specified native font.
40 explicit Font(NativeFont native_font); 40 explicit Font(NativeFont native_font);
41 41
42 // Construct a Font object with the specified PlatformFont object. The Font 42 // Construct a Font object with the specified PlatformFont object. The Font
43 // object takes ownership of the PlatformFont object. 43 // object takes ownership of the PlatformFont object.
44 explicit Font(PlatformFont* platform_font); 44 explicit Font(PlatformFont* platform_font);
45 45
46 // Creates a font with the specified name and size in pixels. 46 // Creates a font with the specified name in UTF-8 and size in pixels.
47 Font(const string16& font_name, int font_size); 47 Font(const std::string& font_name, int font_size);
48 48
49 ~Font(); 49 ~Font();
50 50
51 // Returns a new Font derived from the existing font. 51 // Returns a new Font derived from the existing font.
52 // |size_deta| is the size in pixels to add to the current font. For example, 52 // |size_deta| is the size in pixels to add to the current font. For example,
53 // a value of 5 results in a font 5 pixels bigger than this font. 53 // a value of 5 results in a font 5 pixels bigger than this font.
54 Font DeriveFont(int size_delta) const; 54 Font DeriveFont(int size_delta) const;
55 55
56 // Returns a new Font derived from the existing font. 56 // Returns a new Font derived from the existing font.
57 // |size_delta| is the size in pixels to add to the current font. See the 57 // |size_delta| is the size in pixels to add to the current font. See the
(...skipping 20 matching lines...) Expand all
78 int GetStringWidth(const string16& text) const; 78 int GetStringWidth(const string16& text) const;
79 79
80 // Returns the expected number of horizontal pixels needed to display the 80 // Returns the expected number of horizontal pixels needed to display the
81 // specified length of characters. Call GetStringWidth() to retrieve the 81 // specified length of characters. Call GetStringWidth() to retrieve the
82 // actual number. 82 // actual number.
83 int GetExpectedTextWidth(int length) const; 83 int GetExpectedTextWidth(int length) const;
84 84
85 // Returns the style of the font. 85 // Returns the style of the font.
86 int GetStyle() const; 86 int GetStyle() const;
87 87
88 // Returns the font name. 88 // Returns the font name in UTF-8.
89 string16 GetFontName() const; 89 std::string GetFontName() const;
90 90
91 // Returns the font size in pixels. 91 // Returns the font size in pixels.
92 int GetFontSize() const; 92 int GetFontSize() const;
93 93
94 // Returns the native font handle. 94 // Returns the native font handle.
95 // Lifetime lore: 95 // Lifetime lore:
96 // Windows: This handle is owned by the Font object, and should not be 96 // Windows: This handle is owned by the Font object, and should not be
97 // destroyed by the caller. 97 // destroyed by the caller.
98 // Mac: The object is owned by the system and should not be released. 98 // Mac: The object is owned by the system and should not be released.
99 // Gtk: This handle is created on demand, and must be freed by calling 99 // Gtk: This handle is created on demand, and must be freed by calling
100 // pango_font_description_free() when the caller is done using it. 100 // pango_font_description_free() when the caller is done using it.
101 NativeFont GetNativeFont() const; 101 NativeFont GetNativeFont() const;
102 102
103 // Raw access to the underlying platform font implementation. Can be 103 // Raw access to the underlying platform font implementation. Can be
104 // static_cast to a known implementation type if needed. 104 // static_cast to a known implementation type if needed.
105 PlatformFont* platform_font() const { return platform_font_.get(); } 105 PlatformFont* platform_font() const { return platform_font_.get(); }
106 106
107 private: 107 private:
108 // Wrapped platform font implementation. 108 // Wrapped platform font implementation.
109 scoped_refptr<PlatformFont> platform_font_; 109 scoped_refptr<PlatformFont> platform_font_;
110 }; 110 };
111 111
112 } // namespace gfx 112 } // namespace gfx
113 113
114 #endif // UI_GFX_FONT_H_ 114 #endif // UI_GFX_FONT_H_
OLDNEW
« no previous file with comments | « printing/print_settings_initializer.cc ('k') | ui/gfx/font.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698