哪些值可以在NSFont.TextStyleOptionKey中使用



我没有找到NSFont.TextStyleOptionKey的有效值。

更具体地说,我想使用NSFont.preferredFont(forTextStyle:options:)具有动态(动态点大小)类型,但我想改变字体的粗细。

这些值是由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

jump to definition命令显示如下:

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
}

其他选项可以在文档中找到:https://developer.apple.com/documentation/appkit/nsfont/textstyleoptionkey

相关内容

  • 没有找到相关文章

最新更新