---
title: "CTFontCreateWithFontDescriptorAndOptions(_:_:_:_:)"
framework: coretext
role: symbol
role_heading: Function
path: "coretext/ctfontcreatewithfontdescriptorandoptions(_:_:_:_:)"
---

# CTFontCreateWithFontDescriptorAndOptions(_:_:_:_:)

Returns a new font reference that best matches the given font descriptor.

## Declaration

```swift
func CTFontCreateWithFontDescriptorAndOptions(_ descriptor: CTFontDescriptor, _ size: CGFloat, _ matrix: UnsafePointer<CGAffineTransform>?, _ options: CTFontOptions) -> CTFont
```

## Parameters

- `descriptor`: A font descriptor containing attributes that specify the requested font.
- `size`: The point size for the font reference. If 0.0 is specified, the default font size of 12.0 is used. This parameter is optional.
- `matrix`: The transformation matrix for the font. In most cases, set this parameter to be NULL. If NULL is specified, the identity matrix is used. This parameter is optional.
- `options`: Options flags. See doc://com.apple.coretext/documentation/CoreText/CTFontOptions for values. This parameter is optional.

## Return Value

Return Value A CTFontRef that best matches the attributes provided with the font descriptor.

## Discussion

Discussion The size and matrix parameters override any specified in the font descriptor, unless they are unspecified (0.0 for size and NULL for matrix and options). A best match font is always returned, and default values are used for any unspecified.

## See Also

### Creating Fonts

- [CTFontCreateWithName(_:_:_:)](coretext/ctfontcreatewithname(_:_:_:).md)
- [CTFontCreateWithNameAndOptions(_:_:_:_:)](coretext/ctfontcreatewithnameandoptions(_:_:_:_:).md)
- [CTFontCreateWithFontDescriptor(_:_:_:)](coretext/ctfontcreatewithfontdescriptor(_:_:_:).md)
- [CTFontCreateUIFontForLanguage(_:_:_:)](coretext/ctfontcreateuifontforlanguage(_:_:_:).md)
- [CTFontCreateCopyWithAttributes(_:_:_:_:)](coretext/ctfontcreatecopywithattributes(_:_:_:_:).md)
- [CTFontCreateCopyWithSymbolicTraits(_:_:_:_:_:)](coretext/ctfontcreatecopywithsymbolictraits(_:_:_:_:_:).md)
- [CTFontCreateCopyWithFamily(_:_:_:_:)](coretext/ctfontcreatecopywithfamily(_:_:_:_:).md)
- [CTFontCreateForString(_:_:_:)](coretext/ctfontcreateforstring(_:_:_:).md)
- [CTFontCreateForStringWithLanguage(_:_:_:_:)](coretext/ctfontcreateforstringwithlanguage(_:_:_:_:).md)
