<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSFontManager/setFontManagerFactory(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSFontManager(cm)setFontManagerFactory:"
  },
  "title" : "setFontManagerFactory(_:)"
}
-->

# setFontManagerFactory(_:)

Sets the class that creates the shared font manager object.

```
class func setFontManagerFactory(_ factoryId: AnyClass?)
```

## Parameters

`factoryId`

The new font manager factory class, which must be a subclass of [`NSFontManager`](/documentation/AppKit/NSFontManager).

## Discussion

When you call the [`shared`](/documentation/AppKit/NSFontManager/shared) method of [`NSFontManager`](/documentation/AppKit/NSFontManager), it creates an instance of `aClass`, if no instance already exists. The class in `aClass` must implement `init` as its designated initializer. The default font manager factory is `NSFontManager`.

Call this method before AppKit loads your application’s main nib file, such as in your app delegate’s [`applicationWillFinishLaunching(_:)`](/documentation/AppKit/NSApplicationDelegate/applicationWillFinishLaunching(_:)) method.

---

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)