<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSFont/init(name:size:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSFont(cm)fontWithName:size:"
  },
  "title" : "init(name:size:)"
}
-->

# init(name:size:)

Creates a font object for the specified font name and font size.

```
init?(name fontName: String, size fontSize: CGFloat)
```

## Parameters

`fontName`

The fully specified family-face name of the font.

`fontSize`

The size in points to which the font is scaled.

## Return Value

A font object for the specified name and size.

## Discussion

The value of the `fontName` parameter is a fully specified family-face name, preferably the PostScript name, such as Helvetica-BoldOblique or Times-Roman. (The Font Book app displays PostScript names of fonts in the Font Info panel.)

Specifying `fontSize` is equivalent to using a font matrix of [`fontSize` 0 0 `fontSize` 0 0] with [`init(descriptor:size:)`](/documentation/AppKit/NSFont/init(descriptor:size:)). If you use a `fontSize` of 0.0, this method uses the default User Font size.

Fonts created with this method automatically flip themselves in flipped views. This method is the preferred means for creating fonts.

---

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)