Tuesday, December 3, 2019

Ordering the Typefaces in a Font

Gus Mueller:

The docs for -[NSFontManager availableMembersOfFontFamily:] say:

“The members of the family are arranged in the font panel order (narrowest to widest, lightest to boldest, plain to italic)”

Unfortunately, it looks like this is broken on MacOS 10.15.1. Running Acorn on 10.14 produces the order as described (and as seen below with Helvetica Neue).

Jiang Jiang:

As a workaround, calling CTFontDescriptorCreateMatchingFontDescriptors() with a font descriptor created from @{ kCTFontFamilyNameAttribute: familyName } should give you descriptors in the right order. Then you can get localized style names out of the descriptors.

Comments RSS · Twitter

Leave a Comment