Contents

matchingFontDescriptor(withMandatoryKeys:)

Returns a normalized font descriptor whose specified attributes match those of the receiver.

Declaration

func matchingFontDescriptor(withMandatoryKeys mandatoryKeys: Set<NSFontDescriptor.AttributeName>?) -> NSFontDescriptor?

Parameters

  • mandatoryKeys:

    Keys that must be identical to be matched. Can be nil.

Return Value

The matching font descriptor. If there is no font that matches the given mandatory key values, returns nil.

Discussion

If more than one font matches the [NSFontNameAttribute, NSFontFamilyAttribute, NSFontVisibleNameAttribute, NSFontFaceAttribute] attributes, the list of font descriptors is filtered by the other mandatory keys, if any, and the top result that is returned is the same as the first element returned from matchingFontDescriptors(withMandatoryKeys:).

See Also

Finding Fonts