blob: 14440b53833b867b1b4a01cf625100eef5103a8e [file] [log] [blame]
reed@google.comdf499912011-03-22 14:07:59 +00001/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00002 * 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.
reed@google.comdf499912011-03-22 14:07:59 +00006 */
7
reed@google.comdf499912011-03-22 14:07:59 +00008#ifndef SkTypeface_mac_DEFINED
9#define SkTypeface_mac_DEFINED
10
11#include "SkTypeface.h"
reed@google.comdf499912011-03-22 14:07:59 +000012
halcanary0cbe7ee2015-12-01 09:02:49 -080013#if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
14
bungeman78884012015-06-08 13:39:12 -070015#include <CoreFoundation/CoreFoundation.h>
bungemand6e9fc72015-06-08 17:47:06 -040016
17#ifdef SK_BUILD_FOR_MAC
18#import <ApplicationServices/ApplicationServices.h>
19#endif
20
21#ifdef SK_BUILD_FOR_IOS
yangsu@google.comccb74ea2011-06-21 13:09:32 +000022#include <CoreText/CoreText.h>
bungemand6e9fc72015-06-08 17:47:06 -040023#endif
bungeman78884012015-06-08 13:39:12 -070024
reed@google.comdf499912011-03-22 14:07:59 +000025/**
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.
bungeman78884012015-06-08 13:39:12 -070029 *
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 .
reed@google.comdf499912011-03-22 14:07:59 +000033 */
bungeman78884012015-06-08 13:39:12 -070034SK_API extern SkTypeface* SkCreateTypefaceFromCTFont(CTFontRef, CFTypeRef = NULL);
35
dominik.rottsches94886482015-02-18 10:50:58 -080036/**
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 */
46SK_API extern CTFontRef SkTypeface_GetCTFontRef(const SkTypeface* face);
bungeman78884012015-06-08 13:39:12 -070047
halcanary0cbe7ee2015-12-01 09:02:49 -080048#endif // defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
49#endif // SkTypeface_mac_DEFINED