---
title: "init(name:size:)"
framework: uikit
role: symbol
role_heading: Initializer
path: "uikit/uifont/init(name:size:)"
---

# init(name:size:)

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

## Declaration

```swift
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

Return Value A font object of the specified name and size.

## Discussion

Discussion You can use the fontNames(forFamilyName:) method to retrieve the specific font names for a given font family.

## See Also

### Related Documentation

- [familyNames](uikit/uifont/familynames.md)
- [fontNames(forFamilyName:)](uikit/uifont/fontnames(forfamilyname:).md)

### Creating Fonts

- [Scaling fonts automatically](uikit/scaling-fonts-automatically.md)
- [Creating self-sizing table view cells](uikit/creating-self-sizing-table-view-cells.md)
- [preferredFont(forTextStyle:)](uikit/uifont/preferredfont(fortextstyle:).md)
- [preferredFont(forTextStyle:compatibleWith:)](uikit/uifont/preferredfont(fortextstyle:compatiblewith:).md)
- [UIFont.TextStyle](uikit/uifont/textstyle.md)
- [init(descriptor:size:)](uikit/uifont/init(descriptor:size:).md)
- [withSize(_:)](uikit/uifont/withsize(_:).md)
