Instance Method

matchingFontDescriptorWithMandatoryKeys:

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

Declaration

- (NSFontDescriptor *)matchingFontDescriptorWithMandatoryKeys:(NSSet<NSFontDescriptorAttributeName> *)mandatoryKeys;

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 matchingFontDescriptorsWithMandatoryKeys:.

See Also

Finding Fonts

- matchingFontDescriptorsWithMandatoryKeys:

Returns all the fonts available on the system whose specified attributes match those of the receiver.