[Foundation] Move NSAttributedStringDocumentAttributes.HyphenationFator to shared code.

This property has also been added on macOS (where it didn't exist before), since
both documentation and headers reveal it's available there.
This commit is contained in:
Rolf Bjarne Kvinge 2022-11-23 21:32:06 +01:00
Родитель 01f770c24d
Коммит a34b630304
2 изменённых файлов: 12 добавлений и 15 удалений

Просмотреть файл

@ -41,21 +41,6 @@ namespace Foundation {
public partial class NSAttributedStringDocumentAttributes : DictionaryContainer { public partial class NSAttributedStringDocumentAttributes : DictionaryContainer {
#if !MONOMAC && !COREBUILD #if !MONOMAC && !COREBUILD
public float? HyphenationFactor {
get {
return GetFloatValue (NSAttributedStringDocumentAttributeKey.NSHyphenationFactorDocumentAttribute);
}
set {
if (value is null)
RemoveValue (NSAttributedStringDocumentAttributeKey.NSHyphenationFactorDocumentAttribute);
else {
if (value < 0 || value > 1.0f)
throw new ArgumentException ("value must be between 0 and 1");
SetNumberValue (NSAttributedStringDocumentAttributeKey.NSHyphenationFactorDocumentAttribute, value);
}
}
}
public float? DefaultTabInterval { public float? DefaultTabInterval {
get { get {
return GetFloatValue (NSAttributedStringDocumentAttributeKey.NSDefaultTabIntervalDocumentAttribute); return GetFloatValue (NSAttributedStringDocumentAttributeKey.NSDefaultTabIntervalDocumentAttribute);

Просмотреть файл

@ -42,6 +42,18 @@ namespace Foundation {
} }
} }
public float? HyphenationFactor {
get {
return GetFloatValue (NSAttributedStringDocumentAttributeKey.NSHyphenationFactorDocumentAttribute);
}
set {
if (value < 0 || value > 1.0f)
throw new ArgumentOutOfRangeException (nameof (value), value, "Value must be between 0 and 1");
SetNumberValue (NSAttributedStringDocumentAttributeKey.NSHyphenationFactorDocumentAttribute, value);
}
}
public NSStringEncoding? StringEncoding { public NSStringEncoding? StringEncoding {
get { get {
return (NSStringEncoding?) (long?) GetNIntValue (NSAttributedStringDocumentAttributeKey.NSCharacterEncodingDocumentAttribute); return (NSStringEncoding?) (long?) GetNIntValue (NSAttributedStringDocumentAttributeKey.NSCharacterEncodingDocumentAttribute);