UIFontAttributes.FeatureSettings 属性

定义

版式和布局功能设置。

public UIKit.UIFontFeature[] FeatureSettings { get; set; }
member this.FeatureSettings : UIKit.UIFontFeature[] with get, set

属性值

注解

此属性是 UIFontFeature 对象的数组,每个对象表示可在字体中启用的特定于字体的版式或布局功能。 有关字体功能的背景,可以阅读 https://developer.apple.com/fonts/registry

以下示例演示如何将字体配置为使用比例数字,以及如何通知呈现引擎使用此字体中可用的第 1 个字符替代项。

UIFont CustomizeFont (UIFont font)
{
    var originalDescriptor = font.FontDescriptor;
    var attributes = new UIFontAttributes (
	new UIFontFeature (CTFontFeatureNumberSpacing.Selector.ProportionalNumbers),
	new UIFontFeature ((CTFontFeatureCharacterAlternatives.Selector)1));

    var newDesc = originalDescriptor.CreateWithAttributes (attributes);
    return UIFont.FromDescriptor (newDesc, 80);
}

适用于