summaryrefslogtreecommitdiffstats
path: root/ui/gfx/platform_font_mac.mm
diff options
context:
space:
mode:
authorstuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-24 14:32:02 +0000
committerstuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-24 14:32:02 +0000
commit7cc9e9f7f247ed853dc75cf8a1c3e508b745efec (patch)
tree6f5934f645c82fcbf1723b72a53a4ef3f25e4107 /ui/gfx/platform_font_mac.mm
parentff8e0619ee011a2cb8d1fd4d51f7b7c7ceb59995 (diff)
downloadchromium_src-7cc9e9f7f247ed853dc75cf8a1c3e508b745efec.zip
chromium_src-7cc9e9f7f247ed853dc75cf8a1c3e508b745efec.tar.gz
chromium_src-7cc9e9f7f247ed853dc75cf8a1c3e508b745efec.tar.bz2
Re-add GetStringWidth to PlatformFont, and use that from Font
Font is supposed to be an abstraction, so shouldn't depend directly on Skia. Partially reverses http://codereview.chromium.org/9117009 BUG=None TEST=None Review URL: http://codereview.chromium.org/9465002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@123476 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/platform_font_mac.mm')
-rw-r--r--ui/gfx/platform_font_mac.mm6
1 files changed, 6 insertions, 0 deletions
diff --git a/ui/gfx/platform_font_mac.mm b/ui/gfx/platform_font_mac.mm
index 898ab57..d433f7b 100644
--- a/ui/gfx/platform_font_mac.mm
+++ b/ui/gfx/platform_font_mac.mm
@@ -10,6 +10,7 @@
#include "base/memory/scoped_nsobject.h"
#include "base/sys_string_conversions.h"
#include "base/utf_string_conversions.h"
+#include "ui/gfx/canvas_skia.h"
#include "ui/gfx/font.h"
namespace gfx {
@@ -55,6 +56,11 @@ int PlatformFontMac::GetAverageCharacterWidth() const {
return average_width_;
}
+int PlatformFontMac::GetStringWidth(const string16& text) const {
+ return CanvasSkia::GetStringWidth(text,
+ Font(const_cast<PlatformFontMac*>(this)));
+}
+
int PlatformFontMac::GetExpectedTextWidth(int length) const {
return length * average_width_;
}