CPF/CPF.Mac/Mac/CoreText/CTFontFeatureSettings.cs
2023-11-21 23:05:03 +08:00

56 lines
1.1 KiB
C#

using CPF.Mac.Foundation;
using CPF.Mac.ObjCRuntime;
using System;
namespace CPF.Mac.CoreText
{
[Since(3, 2)]
public class CTFontFeatureSettings
{
public NSDictionary Dictionary
{
get;
private set;
}
[Advice("Use FeatureGroup property instead")]
public NSNumber TypeIdentifier
{
get
{
return (NSNumber)Dictionary[CTFontFeatureKey.Identifier];
}
set
{
Adapter.SetValue(Dictionary, CTFontFeatureKey.Identifier, value);
}
}
public FontFeatureGroup FeatureGroup => (FontFeatureGroup)(int)(NSNumber)Dictionary[CTFontFeatureKey.Identifier];
[Advice("Use FeatureWeak or FeatureGroup instead")]
public NSNumber SelectorIdentifier
{
get
{
return (NSNumber)Dictionary[CTFontFeatureSelectorKey.Identifier];
}
set
{
Adapter.SetValue(Dictionary, CTFontFeatureSelectorKey.Identifier, value);
}
}
public int FeatureWeak => (int)(NSNumber)Dictionary[CTFontFeatureSelectorKey.Identifier];
public CTFontFeatureSettings(NSDictionary dictionary)
{
if (dictionary == null)
{
throw new ArgumentNullException("dictionary");
}
Dictionary = dictionary;
}
}
}