| Index: ui/gfx/canvas_ios.mm
|
| diff --git a/ui/gfx/canvas_ios.mm b/ui/gfx/canvas_ios.mm
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..a1f45d291e90c6857416e4f88c1660562feef38d
|
| --- /dev/null
|
| +++ b/ui/gfx/canvas_ios.mm
|
| @@ -0,0 +1,36 @@
|
| +// 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.
|
| +
|
| +#include "ui/gfx/canvas.h"
|
| +
|
| +#import <UIKit/UIKit.h>
|
| +
|
| +#include <algorithm>
|
| +#include <cmath>
|
| +
|
| +#include "base/logging.h"
|
| +#include "base/strings/sys_string_conversions.h"
|
| +#include "ui/gfx/font_list.h"
|
| +
|
| +namespace gfx {
|
| +
|
| +// static
|
| +void Canvas::SizeStringInt(const base::string16& text,
|
| + const gfx::FontList& font_list,
|
| + int* width,
|
| + int* height,
|
| + int line_height,
|
| + int flags) {
|
| + DLOG_IF(WARNING, line_height != 0) << "Line height not implemented.";
|
| + DLOG_IF(WARNING, flags & Canvas::MULTI_LINE) << "Multi-line not implemented.";
|
| +
|
| + NSString* ns_text = base::SysUTF16ToNSString(text);
|
| + CGSize size = [ns_text
|
| + sizeWithFont:font_list.GetPrimaryFont().GetNativeFont()];
|
| + *width = std::ceil(size.width);
|
| + *height = std::max(static_cast<int>(std::ceil(size.height)),
|
| + font_list.GetHeight());
|
| +}
|
| +
|
| +} // namespace gfx
|
|
|