1 /*
2  * Copyright 2011 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #ifndef SkTypeface_mac_DEFINED
9 #define SkTypeface_mac_DEFINED
10 
11 #include "SkTypeface.h"
12 
13 #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
14 
15 #include <CoreFoundation/CoreFoundation.h>
16 
17 #ifdef SK_BUILD_FOR_MAC
18 #import <ApplicationServices/ApplicationServices.h>
19 #endif
20 
21 #ifdef SK_BUILD_FOR_IOS
22 #include <CoreText/CoreText.h>
23 #endif
24 
25 /**
26  *  Like the other Typeface create methods, this returns a new reference to the
27  *  corresponding typeface for the specified CTFontRef. The caller must call
28  *  unref() when it is finished.
29  *
30  *  The CFTypeRef parameter, if provided, will be kept referenced for the
31  *  lifetime of the SkTypeface. This was introduced as a means to work around
32  *  https://crbug.com/413332 .
33  */
34 SK_API extern SkTypeface* SkCreateTypefaceFromCTFont(CTFontRef, CFTypeRef = NULL);
35 
36 /**
37  *  Returns the platform-specific CTFontRef handle for a
38  *  given SkTypeface. Note that the returned CTFontRef gets
39  *  released when the source SkTypeface is destroyed.
40  *
41  *  This method is deprecated. It may only be used by Blink Mac
42  *  legacy code in special cases related to text-shaping
43  *  with AAT fonts, clipboard handling and font fallback.
44  *  See https://code.google.com/p/skia/issues/detail?id=3408
45  */
46 SK_API extern CTFontRef SkTypeface_GetCTFontRef(const SkTypeface* face);
47 
48 #endif  // defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
49 #endif  // SkTypeface_mac_DEFINED
50