<!--
{
  "availability" : [
    "macOS: 10.7.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSFontCollection",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSFontCollection"
  },
  "title" : "NSFontCollection"
}
-->

# NSFontCollection

A font collection, which is a group of font descriptors taken together as a single object.

```
class NSFontCollection
```

## Overview

You can publicize the font collection as a named collection and it is presented through the System user interface such as the font panel and Font Book. The queries can be modified using the [`NSMutableFontCollection`](/documentation/AppKit/NSMutableFontCollection) subclass.

## Topics

### Creating Font Collections

[`+  fontCollectionWithDescriptors:`](/documentation/AppKit/NSFontCollection/init(descriptors:))

Returns a font collection matching the given descriptors.

[`+  fontCollectionWithLocale:`](/documentation/AppKit/NSFontCollection/init(locale:))

Returns a collection of fonts matching the given locale.

[`+  fontCollectionWithName:`](/documentation/AppKit/NSFontCollection/init(name:))

Creates a named font collection object.

[`+  fontCollectionWithName:visibility:`](/documentation/AppKit/NSFontCollection/init(name:visibility:))

Creates a font collection with the specified name and font visibility.

[`fontCollectionWithAllAvailableDescriptors`](/documentation/AppKit/NSFontCollection/withAllAvailableDescriptors)

The font collection that matches all registered fonts.

### Naming the Font Collection

[`+  renameFontCollectionWithName:visibility:toName:error:`](/documentation/AppKit/NSFontCollection/rename(fromName:visibility:toName:))

Renames the font collection with the specified name and visibility to the second name specified.

[`+  showFontCollection:withName:visibility:error:`](/documentation/AppKit/NSFontCollection/show(_:withName:visibility:))

Make the given font collection visible by giving it a name.

[`+  hideFontCollectionWithName:visibility:error:`](/documentation/AppKit/NSFontCollection/hide(withName:visibility:))

Remove from view the named font collection with the specified visibility.

[`allFontCollectionNames`](/documentation/AppKit/NSFontCollection/allFontCollectionNames)

Returns all named collections visible to this process.

[`Name`](/documentation/AppKit/NSFontCollection/Name)

The constants represent the standard mutable collection names—these names are included in the list of [`allFontCollectionNames`](/documentation/AppKit/NSFontCollection/allFontCollectionNames)–they have special meaning to the Cocoa font system and should not be hidden or renamed.

[`Visibility`](/documentation/AppKit/NSFontCollection/Visibility)

Constants that specify the visibility of font collections.

### Getting the Font Descriptors

[`matchingDescriptors`](/documentation/AppKit/NSFontCollection/matchingDescriptors)

An array of font descriptors matching the logical descriptors.

[`-  matchingDescriptorsForFamily:`](/documentation/AppKit/NSFontCollection/matchingDescriptors(forFamily:))

Returns an array of font descriptors matching the logical descriptors for the given font family.

[`-  matchingDescriptorsForFamily:options:`](/documentation/AppKit/NSFontCollection/matchingDescriptors(forFamily:options:))

Returns an array of font descriptors matching the logical descriptors for the given font family and options.

[`-  matchingDescriptorsWithOptions:`](/documentation/AppKit/NSFontCollection/matchingDescriptors(options:))

Returns an array of font descriptors matching the logical descriptors with the given options.

[`NSFontCollectionMatchingOptionKey`](/documentation/AppKit/NSFontCollectionMatchingOptionKey)

These constants are used by the [`matchingDescriptors(options:)`](/documentation/AppKit/NSFontCollection/matchingDescriptors(options:)) and [`matchingDescriptors(forFamily:options:)`](/documentation/AppKit/NSFontCollection/matchingDescriptors(forFamily:options:)) options dictionary parameters.

[`queryDescriptors`](/documentation/AppKit/NSFontCollection/queryDescriptors)

An array of font descriptors whose matching results produce the collection’s matching descriptors.

[`exclusionDescriptors`](/documentation/AppKit/NSFontCollection/exclusionDescriptors)

A list of query font descriptors whose matching results are excluded from the list of matching descriptors.

### Responding to Changes

[`NSFontCollectionDidChangeNotification`](/documentation/AppKit/NSFontCollection/didChangeNotification)

Posted whenever a font collection is changed.

[`UserInfoKey`](/documentation/AppKit/NSFontCollection/UserInfoKey)

These constants are used as keys in the [`didChangeNotification`](/documentation/AppKit/NSFontCollection/didChangeNotification) `userInfo` dictionary to indicate the changes that have taken place.

[`ActionTypeKey`](/documentation/AppKit/NSFontCollection/ActionTypeKey)

The following actions are possible values of the [`actionUserInfoKey`](/documentation/AppKit/NSFontCollection/actionUserInfoKey) in the [`didChangeNotification`](/documentation/AppKit/NSFontCollection/didChangeNotification) `userInfo` method.

## Relationships

### Conforms To

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`NSMutableCopying`](/documentation/Foundation/NSMutableCopying)

[`CVarArg`](/documentation/Swift/CVarArg)

[`Hashable`](/documentation/Swift/Hashable)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`Equatable`](/documentation/Swift/Equatable)

[`NSCoding`](/documentation/Foundation/NSCoding)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`NSCopying`](/documentation/Foundation/NSCopying)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

### Inherited By

[`NSMutableFontCollection`](/documentation/AppKit/NSMutableFontCollection)

---

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)