---
title: "custom(_:size:relativeTo:)"
framework: swiftui
role: symbol
role_heading: Type Method
path: "swiftui/font/custom(_:size:relativeto:)"
---

# custom(_:size:relativeTo:)

Create a custom font with the given name and size that scales relative to the given textStyle.

## Declaration

```swift
static func custom(_ name: String, size: CGFloat, relativeTo textStyle: Font.TextStyle) -> Font
```

## See Also

### Creating custom fonts

- [custom(_:fixedSize:)](swiftui/font/custom(_:fixedsize:).md)
- [custom(_:size:)](swiftui/font/custom(_:size:).md)
