<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIFont/init(name:size:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIFont(cm)fontWithName:size:"
  },
  "title" : "init(name:size:)"
}
-->

# init(name:size:)

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

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

## Parameters

`fontName`

The fully specified name of the font. This name incorporates both the font family name and the specific style information for the font.

`fontSize`

The size (in points) to which the font is scaled. This value must be greater than 0.0.

## Return Value

A font object of the specified name and size.

## Discussion

You can use the [`fontNames(forFamilyName:)`](/documentation/UIKit/UIFont/fontNames(forFamilyName:)) method to retrieve the specific font names for a given font family.

## See Also

[`familyNames`](/documentation/UIKit/UIFont/familyNames)

Returns an array of font family names available on the system.

[`fontNames(forFamilyName:)`](/documentation/UIKit/UIFont/fontNames(forFamilyName:))

Returns an array of font names available in a particular font family.



---

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)