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

Unified Diff: ui/gfx/layout_text.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: Introduces layout_text.h to provide GetStringWidth(). 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
Index: ui/gfx/layout_text.h
diff --git a/ui/gfx/layout_text.h b/ui/gfx/layout_text.h
new file mode 100644
index 0000000000000000000000000000000000000000..70957fb4123c5df3577b281c549774b2bdf894ee
--- /dev/null
+++ b/ui/gfx/layout_text.h
@@ -0,0 +1,31 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_GFX_LAYOUT_TEXT_H_
+#define UI_GFX_LAYOUT_TEXT_H_
+
+#include "base/basictypes.h"
+#include "base/strings/string16.h"
+#include "ui/base/ui_export.h"
+
+namespace gfx {
+
+class FontList;
+
+// LayoutText represents an interface of layout engines and provides APIs to get
+// text layout information.
+class UI_EXPORT LayoutText {
Alexei Svitkine (slow) 2013/08/20 15:17:21 I don't think this needs its own class. Just make
Yuki 2013/08/20 16:45:42 If everyone is okay to define gfx::GetStringWidth(
Yuki 2013/08/21 03:42:44 Done.
+ public:
+ // Returns the number of horizontal pixels needed to display the specified
+ // |text| with |font_list|.
+ static int GetStringWidth(const base::string16& text,
+ const FontList& font_list);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(LayoutText);
+};
+
+} // namespace gfx
+
+#endif // UI_GFX_LAYOUT_TEXT_H_

Powered by Google App Engine
This is Rietveld 408576698