【问题标题】:NSTextView CoreText note: Client requested nameNSTextView CoreText 注释:客户端请求的名称
【发布时间】:2020-11-08 20:42:10
【问题描述】:

NSTextView 将字体设置为.monospacedSystemFont 时,Xcode 会显示有关无效字体的警告。示例:

CoreText note: Client requested name ".SFNSMono-Bold", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:]

【问题讨论】:

    标签: swift xcode macos appkit nstextview


    【解决方案1】:

    NSTextView.typingAttributes设置相同的字体,例如:

    let textView = NSTextView()
    textView.typingAttributes[.font] = NSFont.monospacedSystemFont(ofSize: NSFont.systemFontSize, weight: .regular)
    textView.font = .monospacedSystemFont(ofSize: NSFont.systemFontSize, weight: .regular)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-10-25
      • 2015-02-02
      • 1970-01-01
      • 1970-01-01
      • 2019-06-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多