SkTypeface_mac.h 1.5 KB

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