reed@google.com | df49991 | 2011-03-22 14:07:59 +0000 | [diff] [blame] | 1 | /* |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 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. |
reed@google.com | df49991 | 2011-03-22 14:07:59 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
reed@google.com | df49991 | 2011-03-22 14:07:59 +0000 | [diff] [blame] | 8 | #ifndef SkTypeface_mac_DEFINED |
| 9 | #define SkTypeface_mac_DEFINED |
| 10 | |
| 11 | #include "SkTypeface.h" |
reed@google.com | df49991 | 2011-03-22 14:07:59 +0000 | [diff] [blame] | 12 | |
halcanary | 0cbe7ee | 2015-12-01 09:02:49 -0800 | [diff] [blame] | 13 | #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) |
| 14 | |
bungeman | 7888401 | 2015-06-08 13:39:12 -0700 | [diff] [blame] | 15 | #include <CoreFoundation/CoreFoundation.h> |
bungeman | d6e9fc7 | 2015-06-08 17:47:06 -0400 | [diff] [blame] | 16 | |
| 17 | #ifdef SK_BUILD_FOR_MAC |
| 18 | #import <ApplicationServices/ApplicationServices.h> |
| 19 | #endif |
| 20 | |
| 21 | #ifdef SK_BUILD_FOR_IOS |
yangsu@google.com | ccb74ea | 2011-06-21 13:09:32 +0000 | [diff] [blame] | 22 | #include <CoreText/CoreText.h> |
bungeman | d6e9fc7 | 2015-06-08 17:47:06 -0400 | [diff] [blame] | 23 | #endif |
bungeman | 7888401 | 2015-06-08 13:39:12 -0700 | [diff] [blame] | 24 | |
reed@google.com | df49991 | 2011-03-22 14:07:59 +0000 | [diff] [blame] | 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. |
bungeman | 7888401 | 2015-06-08 13:39:12 -0700 | [diff] [blame] | 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 . |
reed@google.com | df49991 | 2011-03-22 14:07:59 +0000 | [diff] [blame] | 33 | */ |
bungeman | 7888401 | 2015-06-08 13:39:12 -0700 | [diff] [blame] | 34 | SK_API extern SkTypeface* SkCreateTypefaceFromCTFont(CTFontRef, CFTypeRef = NULL); |
| 35 | |
dominik.rottsches | 9488648 | 2015-02-18 10:50:58 -0800 | [diff] [blame] | 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); |
bungeman | 7888401 | 2015-06-08 13:39:12 -0700 | [diff] [blame] | 47 | |
halcanary | 0cbe7ee | 2015-12-01 09:02:49 -0800 | [diff] [blame] | 48 | #endif // defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) |
| 49 | #endif // SkTypeface_mac_DEFINED |