最佳答案
我想通了。
OSF 是一些字体中包含的可选功能,因此我们需要使用
激活此功能UIFontDescriptor *fontDescriptor = [UIFontDescriptor fontDescriptorWithFontAttributes:@{
UIFontDescriptorNameAttribute : @"MyriadPro-Light",
UIFontDescriptorFeatureSettingsAttribute : @[osfFontFeature]
}];
osfFontFeature 在哪里
NSDictionary *osfFontFeature = @{
UIFontFeatureTypeIdentifierKey : @(21),
UIFontFeatureSelectorIdentifierKey : @(0)
};
可以在此处获取功能类型和选择器标识符键: https://developer.apple.com/fonts/TrueType-Reference-Manual/RM09/AppendixF.html#Type21
最后,我们用
创建字体[UIFont fontWithDescriptor:fontDescriptor size:17.0]
关于ios - 如何在 ios 中启用 osf(旧式图形)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25990587/