[CoreText] Adopt XAMCORE_4_0 changes in .NET. (#13789)

This commit is contained in:
Rolf Bjarne Kvinge 2022-01-20 07:45:32 +01:00 коммит произвёл GitHub
Родитель 24d495ed81
Коммит 4068c49e8c
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 54 добавлений и 67 удалений

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

@ -418,121 +418,99 @@ namespace CoreText {
get {return (CTWritingDirection) GetByteValue (CTParagraphStyleSpecifier.BaseWritingDirection);}
}
public
#if XAMCORE_4_0
nfloat
#if NET
public nfloat FirstLineHeadIndent {
#else
float
public float FirstLineHeadIndent {
#endif
FirstLineHeadIndent {
get { return GetFloatValue (CTParagraphStyleSpecifier.FirstLineHeadIndent); }
}
unsafe
#if XAMCORE_4_0
nfloat
#if NET
unsafe nfloat GetFloatValue (CTParagraphStyleSpecifier spec)
#else
float
unsafe float GetFloatValue (CTParagraphStyleSpecifier spec)
#endif
GetFloatValue (CTParagraphStyleSpecifier spec)
{
nfloat value;
if (!CTParagraphStyleGetValueForSpecifier (Handle, spec, (nuint) sizeof (nfloat), &value))
throw new InvalidOperationException ("Unable to get property value.");
return
#if !XAMCORE_4_0
(float)
#if NET
return value;
#else
return (float) value;
#endif
value;
}
public
#if XAMCORE_4_0
nfloat
#if NET
public nfloat HeadIndent {
#else
float
public float HeadIndent {
#endif
HeadIndent {
get { return GetFloatValue (CTParagraphStyleSpecifier.HeadIndent); }
}
public
#if XAMCORE_4_0
nfloat
#if NET
public nfloat TailIndent {
#else
float
public float TailIndent {
#endif
TailIndent {
get { return GetFloatValue (CTParagraphStyleSpecifier.TailIndent); }
}
public
#if XAMCORE_4_0
nfloat
#if NET
public nfloat DefaultTabInterval {
#else
float
public float DefaultTabInterval {
#endif
DefaultTabInterval {
get { return GetFloatValue (CTParagraphStyleSpecifier.DefaultTabInterval); }
}
public
#if XAMCORE_4_0
nfloat
#if NET
public nfloat LineHeightMultiple {
#else
float
public float LineHeightMultiple {
#endif
LineHeightMultiple {
get { return GetFloatValue (CTParagraphStyleSpecifier.LineHeightMultiple); }
}
public
#if XAMCORE_4_0
nfloat
#if NET
public nfloat MaximumLineHeight {
#else
float
public float MaximumLineHeight {
#endif
MaximumLineHeight {
get { return GetFloatValue (CTParagraphStyleSpecifier.MaximumLineHeight); }
}
public
#if XAMCORE_4_0
nfloat
#if NET
public nfloat MinimumLineHeight {
#else
float
public float MinimumLineHeight {
#endif
MinimumLineHeight {
get { return GetFloatValue (CTParagraphStyleSpecifier.MinimumLineHeight); }
}
public
#if XAMCORE_4_0
nfloat
#if NET
public nfloat LineSpacing {
#else
float
public float LineSpacing {
#endif
LineSpacing {
get { return GetFloatValue (CTParagraphStyleSpecifier.LineSpacing); }
}
public
#if XAMCORE_4_0
nfloat
#if NET
public nfloat ParagraphSpacing {
#else
float
public float ParagraphSpacing {
#endif
ParagraphSpacing {
get { return GetFloatValue (CTParagraphStyleSpecifier.ParagraphSpacing); }
}
public
#if XAMCORE_4_0
nfloat
#if NET
public nfloat ParagraphSpacingBefore {
#else
float
public float ParagraphSpacingBefore {
#endif
ParagraphSpacingBefore {
get { return GetFloatValue (CTParagraphStyleSpecifier.ParagraphSpacingBefore); }
}
#endregion

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

@ -82,7 +82,7 @@ namespace CoreText {
{
}
#if XAMCORE_4_0
#if NET
public virtual nfloat GetAscent ()
{
return 0;

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

@ -7,7 +7,7 @@
// Copyright 2018 Microsoft Corporation.
//
#if !XAMCORE_4_0
#if !NET
using System;
using ObjCRuntime;
using Foundation;
@ -15,11 +15,7 @@ using System.Runtime.Versioning;
namespace CoreText {
public static partial class CTTypesetterOptionKey {
#if !NET
[Deprecated (PlatformName.iOS, 6, 0)]
#else
[UnsupportedOSPlatform ("ios6.0")]
#endif
public static readonly NSString DisableBidiProcessing = _DisableBidiProcessing;
public static readonly NSString ForceEmbeddingLevel = _ForceEmbeddingLevel;
}

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

@ -79,7 +79,7 @@ namespace CoreText {
[Deprecated (PlatformName.iOS, 6, 0)]
[Field ("kCTTypesetterOptionDisableBidiProcessing")]
#if !XAMCORE_4_0
#if !NET
[Internal]
NSString _DisableBidiProcessing { get; }
#else
@ -87,7 +87,7 @@ namespace CoreText {
#endif
[Field ("kCTTypesetterOptionForcedEmbeddingLevel")]
#if !XAMCORE_4_0
#if !NET
[Internal]
NSString _ForceEmbeddingLevel { get; }
#else

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

@ -5,6 +5,7 @@ using System;
using CoreGraphics;
using CoreText;
using Foundation;
using ObjCRuntime;
using NUnit.Framework;
using MonoTouchFixtures.CoreGraphics;
@ -25,19 +26,31 @@ namespace MonoTouchFixtures.CoreText {
Width = false;
}
#if NET
public override nfloat GetAscent ()
#else
public override float GetAscent ()
#endif
{
Ascent = true;
return base.GetAscent ();
}
#if NET
public override nfloat GetDescent ()
#else
public override float GetDescent ()
#endif
{
Descent = true;
return base.GetDescent ();
}
#if NET
public override nfloat GetWidth ()
#else
public override float GetWidth ()
#endif
{
Width = true;
return base.GetWidth ();