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

Unified Diff: ui/gfx/platform_font_pango.cc

Issue 138013004: Clean-up: Renames gfx::Font's methods and removes its obsolete methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed unused methods in PlatformFont. Created 6 years, 10 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/gfx/platform_font_pango.h ('k') | ui/gfx/platform_font_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/platform_font_pango.cc
diff --git a/ui/gfx/platform_font_pango.cc b/ui/gfx/platform_font_pango.cc
index c0c19144c11398dda64877c1eb4a16398b9208e5..956be2d13ce62005e810b2a73fbd2c4123e03ea8 100644
--- a/ui/gfx/platform_font_pango.cc
+++ b/ui/gfx/platform_font_pango.cc
@@ -19,8 +19,10 @@
#include "third_party/skia/include/core/SkTypeface.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/font.h"
+#include "ui/gfx/font_list.h"
#include "ui/gfx/linux_font_delegate.h"
#include "ui/gfx/pango_util.h"
+#include "ui/gfx/text_utils.h"
#if defined(TOOLKIT_GTK)
#include <gdk/gdk.h>
@@ -188,16 +190,6 @@ int PlatformFontPango::GetCapHeight() const {
return cap_height_pixels_;
}
-int PlatformFontPango::GetAverageCharacterWidth() const {
- const_cast<PlatformFontPango*>(this)->InitPangoMetrics();
- return SkScalarRoundToInt(average_width_pixels_);
-}
-
-int PlatformFontPango::GetStringWidth(const base::string16& text) const {
- return Canvas::GetStringWidth(text,
- Font(const_cast<PlatformFontPango*>(this)));
-}
-
int PlatformFontPango::GetExpectedTextWidth(int length) const {
double char_width = const_cast<PlatformFontPango*>(this)->GetAverageWidth();
return round(static_cast<float>(length) * char_width);
@@ -392,8 +384,10 @@ void PlatformFontPango::InitPangoMetrics() {
// Yes, this is how Microsoft recommends calculating the dialog unit
// conversions.
- const int text_width_pixels = GetStringWidth(base::ASCIIToUTF16(
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
+ const int text_width_pixels = GetStringWidth(
+ base::ASCIIToUTF16(
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"),
+ FontList(Font(this)));
const double dialog_units_pixels = (text_width_pixels / 26 + 1) / 2;
average_width_pixels_ = std::min(pango_width_pixels, dialog_units_pixels);
}
« no previous file with comments | « ui/gfx/platform_font_pango.h ('k') | ui/gfx/platform_font_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698