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

# init(name:size:)

Returns a font descriptor with the name and size attributes set to the given values.

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

## Parameters

`fontName`

The value for `NSFontNameAttribute`.

`size`

The value for `NSFontSizeAttribute`.

## Return Value

The new font descriptor.

## See Also

[`+  fontDescriptorWithFontAttributes:`](/documentation/AppKit/NSFontDescriptor/fontDescriptorWithFontAttributes:)

Returns a font descriptor with a dictionary of attributes.



---

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)