<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSFont/userFont(ofSize:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSFont(cm)userFontOfSize:"
  },
  "title" : "userFont(ofSize:)"
}
-->

# userFont(ofSize:)

Returns the font used by default for documents and other text under the user’s control (that is, text whose font the user can normally change), in the specified size.

```
class func userFont(ofSize fontSize: CGFloat) -> NSFont?
```

## Parameters

`fontSize`

The size in points to which the font is scaled.

## Return Value

A font object of the specified size.

## Discussion

If `fontSize` is 0 or negative, returns the user font at the default size.

## See Also

[`+  fontWithName:size:`](/documentation/AppKit/NSFont/init(name:size:))

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

[`+  setUserFont:`](/documentation/AppKit/NSFont/setUser(_:))

Sets the font used by default for documents and other text under the user’s control to the specified font.



---

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)