1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/common/mac/font_descriptor.h"
7 #include <Cocoa/Cocoa.h>
9 #include "base/strings/sys_string_conversions.h"
11 FontDescriptor::FontDescriptor(NSFont* font) {
12 font_name = base::SysNSStringToUTF16([font fontName]);
13 font_point_size = [font pointSize];
16 FontDescriptor::FontDescriptor(string16 name, float size) {
18 font_point_size = size;
21 NSFont* FontDescriptor::ToNSFont() const {
22 NSString* font_name_ns = base::SysUTF16ToNSString(font_name);
23 NSFont* font = [NSFont fontWithName:font_name_ns size:font_point_size];