如何解决无法访问系统 Small Caps 字体
我使用以下方法获取系统小型大写字体:
let systemFont = UIFont.systemFont(ofSize: 16.0,weight: UIFont.Weight.regular)
let smallCapsDesc = systemFont.fontDescriptor.addingAttributes([
UIFontDescriptor.AttributeName.featureSettings: [
[
UIFontDescriptor.FeatureKey.featureIdentifier: kLowerCaseType,UIFontDescriptor.FeatureKey.typeIdentifier: kUpperCaseSmallCapsSelector
]
]
])
let smallCapsFont = UIFont(descriptor: smallCapsDesc,size: systemFont.pointSize)
let smallCapsAttrbs: [NSAttributedString.Key : Any] = [NSAttributedString.Key.font : smallCapsFont]
text.setAttributes(smallCapsAttrbs,range: NSRange(location: start,length: length))
并且我收到此错误。
CoreText 注意:客户端请求的名称“.SFUI-Regular”,它会得到 TimesNewRomanPSMT 而不是预期的字体。所有系统UI字体 访问应通过适当的 API 进行,例如 CTFontCreateUIFontForLanguage() 或 +[UIFont systemFontOfSize:].
我不确定是否有其他方法可以获取 San Francisco
字体的 smallCaps 版本。我该怎么做?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。