CTFontManagerRegisterFontURLs(_:_:_:_:)
Registers fonts from the specified font URLs with the font manager.
Declaration
func CTFontManagerRegisterFontURLs(_ fontURLs: CFArray, _ scope: CTFontManagerScope, _ enabled: Bool, _ registrationHandler: ((CFArray, Bool) -> Bool)?)Parameters
- fontURLs:
A file URL for the fonts or collections (in TTC or OTC format) to register. After registering fonts from a file, don’t move or rename the file.
- scope:
A scope constant that defines the availability and lifetime of the registration. If you specify Persistent when you register fonts on iOS, those fonts aren’t automatically available to other processes. Other processes can call Ctfontmanagerrequestfonts(_:_:) to get access to those fonts. See Ctfontmanagerscope for more details.
- enabled:
A Boolean value that indicates whether the font derived from the URL should be enabled for font descriptor matching and discoverable through Ctfontmanagerrequestfonts(_:_:).
- registrationHandler:
A block called as errors arise or upon completion.
The block’s
errorsparameter contains an array of Cferror references; an empty array indicates no errors. Each error reference contains a Cfarray of font descriptors corresponding to Kctfontmanagererrorfonturlskey. These URLs represent the font files causing the error and failing to register successfully.This block may be called multiple times during the registration process. The
doneparameter becomes True when the registration process completes. Return False from the block to stop the registration operation, like after receiving an error.
Discussion
Registered fonts are discoverable through font descriptor matching in the calling process.
See Also
Functions
CTFontDescriptorMatchFontDescriptorsWithProgressHandler(_:_:_:)CTFontManagerCompareFontFamilyNames(_:_:_:)CTFontManagerCopyAvailableFontFamilyNames()CTFontManagerCopyAvailableFontURLs()CTFontManagerCopyAvailablePostScriptNames()CTFontManagerCreateFontDescriptorFromData(_:)CTFontManagerCreateFontDescriptorsFromURL(_:)CTFontManagerCreateFontRequestRunLoopSource(_:_:)CTFontManagerEnableFontDescriptors(_:_:)CTFontManagerGetAutoActivationSetting(_:)CTFontManagerGetScopeForURL(_:)CTFontManagerIsSupportedFont(_:)CTFontManagerRegisterFontsForURL(_:_:_:)CTFontManagerRegisterFontsForURLs(_:_:_:)CTFontManagerRegisterGraphicsFont(_:_:)