---
title: UIFontMetrics
framework: uikit
role: symbol
role_heading: Class
path: uikit/uifontmetrics
---

# UIFontMetrics

A utility object for obtaining custom fonts that scale to support Dynamic Type.

## Declaration

```swift
class UIFontMetrics
```

## Mentioned in

Scaling fonts automatically

## Overview

Overview Use a UIFontMetrics object to support scalable custom fonts in your app. You create a font metrics object that specifies the font style—for example, body or title—that you want to use in your app. You then pass your custom font to the scaledFont(for:) method (or one of the other methods of this class) to obtain a font object that is based on your custom font, has the appropriate style information, and automatically scales to match the current Dynamic Type settings.

## Topics

### Creating a Font Metrics Object

- [init(forTextStyle:)](uikit/uifontmetrics/init(fortextstyle:).md)
- [default](uikit/uifontmetrics/default.md)
- [UIFont.TextStyle](uikit/uifont/textstyle.md)

### Creating Scaled Fonts

- [Scaling fonts automatically](uikit/scaling-fonts-automatically.md)
- [scaledFont(for:)](uikit/uifontmetrics/scaledfont(for:).md)
- [scaledFont(for:compatibleWith:)](uikit/uifontmetrics/scaledfont(for:compatiblewith:).md)
- [scaledFont(for:maximumPointSize:)](uikit/uifontmetrics/scaledfont(for:maximumpointsize:).md)
- [scaledFont(for:maximumPointSize:compatibleWith:)](uikit/uifontmetrics/scaledfont(for:maximumpointsize:compatiblewith:).md)

### Scaling Layout Values

- [scaledValue(for:)](uikit/uifontmetrics/scaledvalue(for:).md)
- [scaledValue(for:compatibleWith:)](uikit/uifontmetrics/scaledvalue(for:compatiblewith:).md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Fonts

- [Scaling fonts automatically](uikit/scaling-fonts-automatically.md)
- [Adding a custom font to your app](uikit/adding-a-custom-font-to-your-app.md)
- [UIFont](uikit/uifont.md)
- [UIFontDescriptor](uikit/uifontdescriptor.md)
- [UIFontDescriptor.SymbolicTraits](uikit/uifontdescriptor/symbolictraits-swift.struct.md)
