0

我将小型大写字母应用于小写字母,但它似乎也包括所有数字。当我仅将其应用于大写字母时也是如此。

有什么方法可以从小型大写字母的影响中排除数字(例如股票天气应用程序中的风速/方向标签),还是我需要借助属性字符串来实现该效果?

目前我只是将字体应用于所有标签内容:

extension UIFont {
    func smallCaps() -> UIFont {
        let settings: [[UIFontDescriptor.FeatureKey : Int]] = [
            [
                .featureIdentifier : kLowerCaseType,
                .typeIdentifier : kLowerCaseSmallCapsSelector
            ]
        ]
        let attributes: [UIFontDescriptor.AttributeName : Any] = [.featureSettings: settings]
        
        return UIFont(descriptor: self.fontDescriptor.addingAttributes(attributes), size: self.pointSize)
    }
}

我尝试使用kNumberCaseTypekUpperCaseNumbersSelector上面的代码一样,但我猜错了。根据文档,事实证明这不是我想要的。

4

0 回答 0