Function

CTFontManagerCompareFontFamilyNames(_:_:_:)

A comparator function to compare font family names and sort them according to Apple guidelines.

Declaration

func CTFontManagerCompareFontFamilyNames(_ family1: UnsafeRawPointer, _ family2: UnsafeRawPointer, _ context: UnsafeMutableRawPointer?) -> CFComparisonResult

Parameters

family1

The first localized font family name to compare, as a CFStringRef object.

family2

The second localized font family name to compare, as a CFStringRef object.

context

Unused. Can be NULL.

Return Value

A CFComparisonResult value indicating the sort order for the two family names. kCFComparisonResultGreatherThan if family1 is greater than family2, kCFComparisonResultLessThan if family1 is less than family2, and kCFComparisonResultEqualTo if they are equal.

Discussion

This CFComparatorFunction function compares font family names and sorts them in the Apple preferred order, accounting for foundry prefix. Family names with recognized prefixes are sorted after the unprefixed names in prefix order.