---
title: "systemFont(ofSize:weight:)"
framework: uikit
role: symbol
role_heading: Type Method
path: "uikit/uifont/systemfont(ofsize:weight:)"
---

# systemFont(ofSize:weight:)

Returns the font object for standard interface items in the specified size and weight.

## Declaration

```swift
class func systemFont(ofSize fontSize: CGFloat, weight: UIFont.Weight) -> UIFont
```

## Parameters

- `fontSize`: The size (in points) to which the font is scaled. This value must be greater than 0.0.
- `weight`: The weight of the font, specified as a font weight constant. For a list of possible values, see “Font Weights” in doc://com.apple.uikit/documentation/UIKit/UIFontDescriptor. Avoid passing an arbitrary floating-point number for weight, because a font might not include a variant for every weight.

## Return Value

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

## Discussion

Discussion Instead of using this method to get a font, it’s often more appropriate to use preferredFont(forTextStyle:) because that method respects the user’s selected content size category.

## See Also

### Creating System Fonts

- [systemFont(ofSize:)](uikit/uifont/systemfont(ofsize:).md)
- [UIFont.Weight](uikit/uifont/weight.md)
- [systemFont(ofSize:weight:width:)](uikit/uifont/systemfont(ofsize:weight:width:).md)
- [UIFont.Width](uikit/uifont/width.md)
- [boldSystemFont(ofSize:)](uikit/uifont/boldsystemfont(ofsize:).md)
- [italicSystemFont(ofSize:)](uikit/uifont/italicsystemfont(ofsize:).md)
- [monospacedSystemFont(ofSize:weight:)](uikit/uifont/monospacedsystemfont(ofsize:weight:).md)
- [monospacedDigitSystemFont(ofSize:weight:)](uikit/uifont/monospaceddigitsystemfont(ofsize:weight:).md)
