diff options
Diffstat (limited to 'gfx/font_mac.mm')
-rw-r--r-- | gfx/font_mac.mm | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/gfx/font_mac.mm b/gfx/font_mac.mm index fcc85833..9a1695b 100644 --- a/gfx/font_mac.mm +++ b/gfx/font_mac.mm @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. @@ -58,12 +58,9 @@ int Font::ave_char_width() const { } int Font::GetStringWidth(const std::wstring& text) const { - NSFont* font = nativeFont(); - NSString* ns_string = base::SysWideToNSString(text); - NSDictionary* attributes = - [NSDictionary dictionaryWithObject:font forKey:NSFontAttributeName]; - NSSize string_size = [ns_string sizeWithAttributes:attributes]; - return string_size.width; + int width = 0, height = 0; + Canvas::SizeStringInt(text, *this, &width, &height, gfx::Canvas::NO_ELLIPSIS); + return width; } int Font::GetExpectedTextWidth(int length) const { |