---
title: "fontAttributes(in:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsattributedstring/fontattributes(in:)"
---

# fontAttributes(in:)

Returns the font attributes in effect for the character at the specified location.

## Declaration

```swift
func fontAttributes(in range: NSRange) -> [NSAttributedString.Key : Any]
```

## Parameters

- `range`: The range.

## Return Value

Return Value A dictionary containing the font attributes for the range.

## Discussion

Discussion The dictionary attributes are all those listed in Character Attributes, except link, paragraphStyle, and attachment. Use this method to obtain font attributes that are to be copied or pasted with “copy font” operations. Raises an NSRangeException if any part of aRange lies beyond the end of the receiver’s characters.

## See Also

### Getting font attribute information

- [rulerAttributes(in:)](foundation/nsattributedstring/rulerattributes(in:).md)
