summaryrefslogtreecommitdiff
path: root/cairomm/quartz_font.h
blob: d29374106b4fc68d01c14be4d795b78bb980880c (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/* Copyright (C) 2008 Jonathon Jongsma
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301, USA.
 */
#ifndef __CAIROMM_QUARTZ_FONT_H
#define __CAIROMM_QUARTZ_FONT_H

#include <cairo-features.h>

#ifdef CAIRO_HAS_QUARTZ_FONT
#include <cairo-quartz.h>
#include <cairomm/fontface.h>
#include <cairomm/scaledfont.h>

namespace Cairo
{

/** Font support for Quartz (CGFont) fonts on OS X.
 *
 * @since 1.8
 */
class QuartzFontFace : public FontFace
{
public:

  /** Creates a new font for the Quartz font backend based on a CGFontRef. This
   * font can then be used with Context::set_font_face() or
   * ScaledFont::create().
   *
   * @param font a CGFontRef obtained through a method external to cairo.
   *
   * @since 1.8
   */
  static RefPtr<QuartzFontFace> create(CGFontRef font);

#ifndef __LP64__
  /** Creates a new font for the Quartz font backend based on an ATSUFontID.
   * This font can then be used with Context::set_font_face() or
   * ScaledFont::create().
   *
   * @param font_id an ATSUFontID for the font.
   *
   * @since 1.8
   */
  static RefPtr<QuartzFontFace> create(ATSUFontID font_id);
#endif


protected:
  QuartzFontFace(CGFontRef font);
#ifndef __LP64__
  QuartzFontFace(ATSUFontID font_id);
#endif
};

}

#endif // CAIRO_HAS_QUARTZ_FONT

#endif // __CAIROMM_QUARTZ_FONT_H