summaryrefslogtreecommitdiffstats
path: root/content/common/mac/font_descriptor.h
blob: f47eb22aebfbbb8c4f6b61818e82988922addb9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright (c) 2012 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.

#ifndef CONTENT_COMMON_MAC_FONT_DESCRIPTOR_H_
#define CONTENT_COMMON_MAC_FONT_DESCRIPTOR_H_

#include "base/strings/string16.h"
#include "content/common/content_export.h"

#ifdef __OBJC__
@class NSFont;
#else
class NSFont;
#endif

// Container to allow serializing an NSFont over IPC.
struct CONTENT_EXPORT FontDescriptor {
  explicit FontDescriptor(NSFont* font);
  FontDescriptor(string16 name, float size);

  FontDescriptor() : font_point_size(0) {}

  // Return an autoreleased NSFont corresponding to the font description.
  NSFont* ToNSFont() const;

  // Name of the font.
  string16 font_name;

  // Size in points.
  float font_point_size;
};

#endif  // CONTENT_COMMON_MAC_FONT_DESCRIPTOR_H_