文本工具包:旧金山的大写数学符号

时间:2015-07-15 17:41:16

标签: ios fonts textkit system-font

在介绍新系统字体时,显示以下屏幕截图。哪个UIFontDescriptorFeatureSettingsAttribute用于启用此行为?

Click me

1 个答案:

答案 0 :(得分:1)

如果其他人正在努力解决这个问题,我发现这个功能会激活它:

let descriptor = UIFont.systemFontOfSize(24.0, weight: UIFontWeightLight).fontDescriptor()
let adjusted = descriptor.fontDescriptorByAddingAttributes(
    [
        UIFontDescriptorFeatureSettingsAttribute: [
            [
                UIFontFeatureTypeIdentifierKey: kCaseSensitiveLayoutType,
                UIFontFeatureSelectorIdentifierKey: kCaseSensitiveLayoutOnSelector
            ]
        ]
    ]
)
return UIFont(descriptor: adjusted, size: 24.0)