<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: 10.0.0 - 10.6.0",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreGraphics",
  "identifier" : "/documentation/CoreGraphics/CGFontCreateWithPlatformFont",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Graphics"
    ],
    "preciseIdentifier" : "c:@F@CGFontCreateWithPlatformFont"
  },
  "title" : "CGFontCreateWithPlatformFont"
}
-->

# CGFontCreateWithPlatformFont

Creates a font object from an Apple Type Services (ATS) font.

```
extern CGFontRefCGFontCreateWithPlatformFont(void *platformFontReference);
```

## Parameters

`platformFontReference`

A generic pointer to a font object. The font should be of a type appropriate to the platform on which your program is running. For macOS, you should pass a pointer to an ATS font.

## Return Value

The font object, or `NULL` if the platform font could not be located. In Objective-C, you’re responsible for releasing this object using [`CGFontRelease`](/documentation/CoreGraphics/CGFontRelease).

## Discussion

Before drawing text in a Core Graphics context, you must set the font in the current graphics state. For ATS Fonts, call this function to create a font, and pass it to [`setFont(_:)`](/documentation/CoreGraphics/CGContext/setFont(_:)).

### Special Considerations

This function is deprecated because it takes a pointer to an `ATSFontRef` object—itself deprecated—and is used almost solely by QuickDraw-based applications. There’s no direct one-to-one replacement for the function. Clients using ATSUI and QuickDraw should move to Core Text and Core Graphics instead.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)