<!--
{
  "availability" : [
    "iOS: 2.0.0 - 7.0.0",
    "iPadOS: 2.0.0 - 7.0.0",
    "tvOS: -",
    "visionOS: 1.0.0 - 1.0.0",
    "watchOS: 2.0.0 - 2.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "CoreGraphics",
  "identifier" : "/documentation/CoreGraphics/CGContext/selectFont(name:size:textEncoding:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Graphics",
      "CoreGraphics"
    ],
    "preciseIdentifier" : "c:@F@CGContextSelectFont"
  },
  "title" : "selectFont(name:size:textEncoding:)"
}
-->

# selectFont(name:size:textEncoding:)

Sets the font and font size in a graphics context.

```
func selectFont(name: UnsafePointer<CChar>, size: CGFloat, textEncoding: CGTextEncoding)
```

## Parameters

`name`

A null-terminated string that contains the PostScript name of the font to set.

`size`

A value that specifies the font size to set, in text space units.

`textEncoding`

A value that specifies the encoding used for the font. For a description of the available values, see [`CGTextEncoding`](/documentation/CoreGraphics/CGTextEncoding).

---

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)