| Index: ui/gfx/canvas_mac.mm
|
| diff --git a/ui/gfx/canvas_mac.mm b/ui/gfx/canvas_mac.mm
|
| index a906873d4e50fa1f191c96491a2cdf0dcc80811a..5cee96ce6eb12de4a99a45bfde9e6d9a2034eb13 100644
|
| --- a/ui/gfx/canvas_mac.mm
|
| +++ b/ui/gfx/canvas_mac.mm
|
| @@ -9,7 +9,7 @@
|
| #include "base/logging.h"
|
| #include "base/strings/sys_string_conversions.h"
|
| #include "third_party/skia/include/core/SkTypeface.h"
|
| -#include "ui/gfx/font.h"
|
| +#include "ui/gfx/font_list.h"
|
| #include "ui/gfx/rect.h"
|
|
|
| // Note: This is a temporary Skia-based implementation of the ui/gfx text
|
| @@ -36,7 +36,7 @@ namespace gfx {
|
|
|
| // static
|
| void Canvas::SizeStringInt(const base::string16& text,
|
| - const gfx::Font& font,
|
| + const gfx::FontList& font_list,
|
| int* width,
|
| int* height,
|
| int line_height,
|
| @@ -44,18 +44,28 @@ void Canvas::SizeStringInt(const base::string16& text,
|
| DLOG_IF(WARNING, line_height != 0) << "Line heights not implemented.";
|
| DLOG_IF(WARNING, flags & Canvas::MULTI_LINE) << "Multi-line not implemented.";
|
|
|
| - NSFont* native_font = font.GetNativeFont();
|
| + NSFont* native_font = font_list.GetPrimaryFont().GetNativeFont();
|
| NSString* ns_string = base::SysUTF16ToNSString(text);
|
| NSDictionary* attributes =
|
| [NSDictionary dictionaryWithObject:native_font
|
| forKey:NSFontAttributeName];
|
| NSSize string_size = [ns_string sizeWithAttributes:attributes];
|
| *width = string_size.width;
|
| - *height = font.GetHeight();
|
| + *height = font_list.GetHeight();
|
| +}
|
| +
|
| +// static
|
| +void Canvas::SizeStringInt(const base::string16& text,
|
| + const gfx::Font& font,
|
| + int* width,
|
| + int* height,
|
| + int line_height,
|
| + int flags) {
|
| + SizeStringInt(text, FontList(font), width, height, line_height, flags);
|
| }
|
|
|
| void Canvas::DrawStringWithShadows(const base::string16& text,
|
| - const gfx::Font& font,
|
| + const gfx::FontList& font_list,
|
| SkColor color,
|
| const gfx::Rect& text_bounds,
|
| int line_height,
|
| @@ -65,6 +75,7 @@ void Canvas::DrawStringWithShadows(const base::string16& text,
|
| DLOG_IF(WARNING, flags & Canvas::MULTI_LINE) << "Multi-line not implemented.";
|
| DLOG_IF(WARNING, !shadows.empty()) << "Text shadows not implemented.";
|
|
|
| + const Font& font = font_list.GetPrimaryFont();
|
| skia::RefPtr<SkTypeface> typeface = skia::AdoptRef(
|
| SkTypeface::CreateFromName(
|
| font.GetFontName().c_str(), FontTypefaceStyle(font)));
|
| @@ -78,6 +89,25 @@ void Canvas::DrawStringWithShadows(const base::string16& text,
|
| paint);
|
| }
|
|
|
| +void Canvas::DrawStringWithShadows(const base::string16& text,
|
| + const gfx::Font& font,
|
| + SkColor color,
|
| + const gfx::Rect& text_bounds,
|
| + int line_height,
|
| + int flags,
|
| + const ShadowValues& shadows) {
|
| + DrawStringWithShadows(text, FontList(font), color, text_bounds, line_height,
|
| + flags, shadows);
|
| +}
|
| +
|
| +void Canvas::DrawStringWithHalo(const base::string16& text,
|
| + const gfx::FontList& font_list,
|
| + SkColor text_color,
|
| + SkColor halo_color,
|
| + const Rect& display_rect,
|
| + int flags) {
|
| +}
|
| +
|
| void Canvas::DrawStringWithHalo(const base::string16& text,
|
| const gfx::Font& font,
|
| SkColor text_color,
|
|
|