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

Unified Diff: ui/base/text/text_elider.h

Issue 22835002: Supports gfx::FontList in gfx::Canvas and ui::ElideText family. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: layout_text.h => text_utils.h Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/base/cocoa/menu_controller.mm ('k') | ui/base/text/text_elider.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/text/text_elider.h
diff --git a/ui/base/text/text_elider.h b/ui/base/text/text_elider.h
index 1d31f8eea637c9b60addd02db1ce8f208818a723..a4ea50da44660e8b34fb7c4b071700ceea32ffeb 100644
--- a/ui/base/text/text_elider.h
+++ b/ui/base/text/text_elider.h
@@ -15,7 +15,6 @@
#include "third_party/icu/source/common/unicode/uchar.h"
#include "third_party/icu/source/i18n/unicode/coll.h"
#include "ui/base/ui_export.h"
-#include "ui/gfx/font.h"
class GURL;
@@ -23,13 +22,18 @@ namespace base {
class FilePath;
}
+namespace gfx {
+class Font;
+class FontList;
+} // namespace gfx
+
namespace ui {
UI_EXPORT extern const char kEllipsis[];
UI_EXPORT extern const char16 kEllipsisUTF16[];
// Elides a well-formed email address (e.g. username@domain.com) to fit into
-// |available_pixel_width| using the specified |font|.
+// |available_pixel_width| using the specified |font_list|.
// This function guarantees that the string returned will contain at least one
// character, other than the ellipses, on either side of the '@'. If it is
// impossible to achieve these requirements: only an ellipsis will be returned.
@@ -39,6 +43,10 @@ UI_EXPORT extern const char16 kEllipsisUTF16[];
// doesn't need half the available width: the elided domain will occupy that
// extra width).
UI_EXPORT string16 ElideEmail(const string16& email,
+ const gfx::FontList& font_list,
+ int available_pixel_width);
+// Obsolete version. Use the above version which takes gfx::FontList.
+UI_EXPORT string16 ElideEmail(const string16& email,
const gfx::Font& font,
int available_pixel_width);
@@ -57,6 +65,11 @@ UI_EXPORT string16 ElideEmail(const string16& email,
// is displayed properly in an RTL context. Please refer to
// http://crbug.com/6487 for more information.
UI_EXPORT string16 ElideUrl(const GURL& url,
+ const gfx::FontList& font_list,
+ int available_pixel_width,
+ const std::string& languages);
+// Obsolete version. Use the above version which takes gfx::FontList.
+UI_EXPORT string16 ElideUrl(const GURL& url,
const gfx::Font& font,
int available_pixel_width,
const std::string& languages);
@@ -73,6 +86,11 @@ enum ElideBehavior {
// Elides |text| to fit in |available_pixel_width| according to the specified
// |elide_behavior|.
UI_EXPORT string16 ElideText(const string16& text,
+ const gfx::FontList& font_list,
+ int available_pixel_width,
+ ElideBehavior elide_behavior);
+// Obsolete version. Use the above version which takes gfx::FontList.
+UI_EXPORT string16 ElideText(const string16& text,
const gfx::Font& font,
int available_pixel_width,
ElideBehavior elide_behavior);
@@ -84,6 +102,10 @@ UI_EXPORT string16 ElideText(const string16& text,
// the elided filename is wrapped with LRE (Left-To-Right Embedding) mark and
// PDF (Pop Directional Formatting) mark.
UI_EXPORT string16 ElideFilename(const base::FilePath& filename,
+ const gfx::FontList& font_list,
+ int available_pixel_width);
+// Obsolete version. Use the above version which takes gfx::FontList.
+UI_EXPORT string16 ElideFilename(const base::FilePath& filename,
const gfx::Font& font,
int available_pixel_width);
@@ -181,12 +203,19 @@ enum ReformattingResultFlags {
// Reformats |text| into output vector |lines| so that the resulting text fits
// into an |available_pixel_width| by |available_pixel_height| rectangle with
-// the specified |font|. Input newlines are respected, but lines that are too
-// long are broken into pieces. For words that are too wide to fit on a single
-// line, the wrapping behavior can be specified with the |wrap_behavior| param.
-// Returns a combination of |ReformattingResultFlags| that indicate whether the
-// given rectangle had insufficient space to accommodate |texŧ|, leading to
-// elision or truncation (and not just reformatting).
+// the specified |font_list|. Input newlines are respected, but lines that are
+// too long are broken into pieces. For words that are too wide to fit on a
+// single line, the wrapping behavior can be specified with the |wrap_behavior|
+// param. Returns a combination of |ReformattingResultFlags| that indicate
+// whether the given rectangle had insufficient space to accommodate |texŧ|,
+// leading to elision or truncation (and not just reformatting).
+UI_EXPORT int ElideRectangleText(const string16& text,
+ const gfx::FontList& font_list,
+ int available_pixel_width,
+ int available_pixel_height,
+ WordWrapBehavior wrap_behavior,
+ std::vector<string16>* lines);
+// Obsolete version. Use the above version which takes gfx::FontList.
UI_EXPORT int ElideRectangleText(const string16& text,
const gfx::Font& font,
int available_pixel_width,
« no previous file with comments | « ui/base/cocoa/menu_controller.mm ('k') | ui/base/text/text_elider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698