---
title: "CTFontCreateWithGraphicsFont(_:_:_:_:)"
framework: coretext
role: symbol
role_heading: Function
path: "coretext/ctfontcreatewithgraphicsfont(_:_:_:_:)"
---

# CTFontCreateWithGraphicsFont(_:_:_:_:)

Creates a new font reference from an existing Core Graphics font reference.

## Declaration

```swift
func CTFontCreateWithGraphicsFont(_ graphicsFont: CGFont, _ size: CGFloat, _ matrix: UnsafePointer<CGAffineTransform>?, _ attributes: CTFontDescriptor?) -> CTFont
```

## Parameters

- `graphicsFont`: A valid Core Graphics font reference.
- `size`: The point size for the font reference. If 0.0 is specified the default font size of 12.0 is used.
- `matrix`: The transformation matrix for the font. In most cases, set this parameter to be NULL. If NULL, the identity matrix is used. Optional.
- `attributes`: Additional attributes that should be matched. Optional.

## Return Value

Return Value A new font reference for an existing CGFont object with the specified size, matrix, and additional attributes.

## See Also

### Converting Fonts

- [CTFontCopyGraphicsFont(_:_:)](coretext/ctfontcopygraphicsfont(_:_:).md)
- [CTFontGetPlatformFont(_:_:)](coretext/ctfontgetplatformfont(_:_:).md)
- [CTFontCreateWithPlatformFont(_:_:_:_:)](coretext/ctfontcreatewithplatformfont(_:_:_:_:).md)
- [CTFontCreateWithQuickdrawInstance(_:_:_:_:)](coretext/ctfontcreatewithquickdrawinstance(_:_:_:_:).md)
