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

Unified Diff: ui/gfx/canvas.h

Issue 24883002: Uses and returns the fractional width in text eliding (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix per feedbacks 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/gfx/canvas.cc » ('j') | ui/gfx/canvas.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/canvas.h
diff --git a/ui/gfx/canvas.h b/ui/gfx/canvas.h
index 9aa7a0a4e4d6cc126b000520ea9bbca9afcd91f3..438a21ae34986bdcfa883c73d1c1a309fd87c43d 100644
--- a/ui/gfx/canvas.h
+++ b/ui/gfx/canvas.h
@@ -139,6 +139,14 @@ class GFX_EXPORT Canvas {
int line_height,
int flags);
+ // This is same as SizeStringInt except that fractional size is returned.
+ static void SizeStringFloat(const base::string16& text,
+ const FontList& font_list,
+ float* width,
+ float* height,
+ int line_height,
+ int flags);
+
// Returns the number of horizontal pixels needed to display the specified
// |text| with |font_list|.
static int GetStringWidth(const base::string16& text,
@@ -146,6 +154,12 @@ class GFX_EXPORT Canvas {
// Obsolete version. Use the above version which takes FontList.
static int GetStringWidth(const base::string16& text, const Font& font);
+ // Returns the pixel width needed to display the specified |text| with
+ // |font_list|. Note that the fractional width might be returned in some
Alexei Svitkine (slow) 2013/10/07 23:33:28 Maybe mention explicitly which ones like the rende
jianli 2013/10/08 00:01:18 Done.
+ // platforms.
+ static float GetStringWidthF(const base::string16& text,
+ const FontList& font_list);
+
// Returns the default text alignment to be used when drawing text on a
// Canvas based on the directionality of the system locale language.
// This function is used by Canvas::DrawStringInt when the text alignment
« no previous file with comments | « no previous file | ui/gfx/canvas.cc » ('j') | ui/gfx/canvas.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698