I haven't been able to find valid values for NSFont.TextStyleOptionKey
.
More specifically I want to use NSFont.preferredFont(forTextStyle:options:)
to have dynamic (dynamic point size) type, but I would like to change the weight of the font.
I haven't been able to find valid values for NSFont.TextStyleOptionKey
.
More specifically I want to use NSFont.preferredFont(forTextStyle:options:)
to have dynamic (dynamic point size) type, but I would like to change the weight of the font.
These values were revealed by autocomplete in XCode:
NSFont.Weight.black
NSFont.Weight.heavy
NSFont.Weight.bold
NSFont.Weight.semibold
NSFont.Weight.medium
NSFont.Weight.regular
NSFont.Weight.light
NSFont.Weight.thin
NSFont.Weight.ultraLight
The jump to definition
command shows this:
extension NSFont.Weight {
@available(macOS 10.11, *)
public static let ultraLight: NSFont.Weight
@available(macOS 10.11, *)
public static let thin: NSFont.Weight
@available(macOS 10.11, *)
public static let light: NSFont.Weight
@available(macOS 10.11, *)
public static let regular: NSFont.Weight
@available(macOS 10.11, *)
public static let medium: NSFont.Weight
@available(macOS 10.11, *)
public static let semibold: NSFont.Weight
@available(macOS 10.11, *)
public static let bold: NSFont.Weight
@available(macOS 10.11, *)
public static let heavy: NSFont.Weight
@available(macOS 10.11, *)
public static let black: NSFont.Weight
}
other options can be found here in the doc: https://developer.apple.com/documentation/appkit/nsfont/textstyleoptionkey