<!--
{
  "availability" : [
    "macOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSAttributedString/fontAttributes(in:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSAttributedString(im)fontAttributesInRange:"
  },
  "title" : "fontAttributes(in:)"
}
-->

# fontAttributes(in:)

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

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

## Parameters

`range`

The range.

## Return Value

A dictionary containing the font attributes for the range.

## Discussion

The dictionary attributes are all those listed in `Character Attributes`, except [`link`](/documentation/Foundation/NSAttributedString/Key/link), [`paragraphStyle`](/documentation/Foundation/NSAttributedString/Key/paragraphStyle), and [`attachment`](/documentation/Foundation/NSAttributedString/Key/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.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)