From a34b630304d987e9c7d57a6dad941d6584cbc4e1 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 23 Nov 2022 21:32:06 +0100 Subject: [PATCH] [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. --- src/Foundation/NSAttributedString.iOS.cs | 15 --------------- .../NSAttributedStringDocumentAttributes.cs | 12 ++++++++++++ 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/Foundation/NSAttributedString.iOS.cs b/src/Foundation/NSAttributedString.iOS.cs index cc821894a3..ec4782190f 100644 --- a/src/Foundation/NSAttributedString.iOS.cs +++ b/src/Foundation/NSAttributedString.iOS.cs @@ -41,21 +41,6 @@ namespace Foundation { public partial class NSAttributedStringDocumentAttributes : DictionaryContainer { #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 { get { return GetFloatValue (NSAttributedStringDocumentAttributeKey.NSDefaultTabIntervalDocumentAttribute); diff --git a/src/Foundation/NSAttributedStringDocumentAttributes.cs b/src/Foundation/NSAttributedStringDocumentAttributes.cs index 0158e31241..f5f3dc4535 100644 --- a/src/Foundation/NSAttributedStringDocumentAttributes.cs +++ b/src/Foundation/NSAttributedStringDocumentAttributes.cs @@ -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 { get { return (NSStringEncoding?) (long?) GetNIntValue (NSAttributedStringDocumentAttributeKey.NSCharacterEncodingDocumentAttribute);