aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/ports/SkTypeface_mac.h
blob: 14440b53833b867b1b4a01cf625100eef5103a8e (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
/*
 * Copyright 2011 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef SkTypeface_mac_DEFINED
#define SkTypeface_mac_DEFINED

#include "SkTypeface.h"

#if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)

#include <CoreFoundation/CoreFoundation.h>

#ifdef SK_BUILD_FOR_MAC
#import <ApplicationServices/ApplicationServices.h>
#endif

#ifdef SK_BUILD_FOR_IOS
#include <CoreText/CoreText.h>
#endif

/**
 *  Like the other Typeface create methods, this returns a new reference to the
 *  corresponding typeface for the specified CTFontRef. The caller must call
 *  unref() when it is finished.
 *
 *  The CFTypeRef parameter, if provided, will be kept referenced for the
 *  lifetime of the SkTypeface. This was introduced as a means to work around
 *  https://crbug.com/413332 .
 */
SK_API extern SkTypeface* SkCreateTypefaceFromCTFont(CTFontRef, CFTypeRef = NULL);

/**
 *  Returns the platform-specific CTFontRef handle for a
 *  given SkTypeface. Note that the returned CTFontRef gets
 *  released when the source SkTypeface is destroyed.
 *
 *  This method is deprecated. It may only be used by Blink Mac
 *  legacy code in special cases related to text-shaping
 *  with AAT fonts, clipboard handling and font fallback.
 *  See https://code.google.com/p/skia/issues/detail?id=3408
 */
SK_API extern CTFontRef SkTypeface_GetCTFontRef(const SkTypeface* face);

#endif  // defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
#endif  // SkTypeface_mac_DEFINED