diff --git a/src/CoreText/Adapter.cs b/src/CoreText/Adapter.cs index 378edbdebfcb..122f50716f6c 100644 --- a/src/CoreText/Adapter.cs +++ b/src/CoreText/Adapter.cs @@ -36,10 +36,6 @@ using Foundation; using ObjCRuntime; -#if !NET -using NativeHandle = System.IntPtr; -#endif - namespace CoreText { internal static class Adapter { diff --git a/src/CoreText/CTBaselineClass.cs b/src/CoreText/CTBaselineClass.cs index cfe49e9840e0..b51f8d5bd4b6 100644 --- a/src/CoreText/CTBaselineClass.cs +++ b/src/CoreText/CTBaselineClass.cs @@ -52,26 +52,6 @@ public enum CTBaselineClass { } static partial class CTBaselineClassID { -#if !NET - public static readonly NSString? Roman; - public static readonly NSString? IdeographicCentered; - public static readonly NSString? IdeographicLow; - public static readonly NSString? IdeographicHigh; - public static readonly NSString? Hanging; - public static readonly NSString? Math; - - static CTBaselineClassID () - { - var handle = Libraries.CoreText.Handle; - Roman = Dlfcn.GetStringConstant (handle, "kCTBaselineClassRoman"); - IdeographicCentered = Dlfcn.GetStringConstant (handle, "kCTBaselineClassIdeographicCentered"); - IdeographicLow = Dlfcn.GetStringConstant (handle, "kCTBaselineClassIdeographicLow"); - IdeographicHigh = Dlfcn.GetStringConstant (handle, "kCTBaselineClassIdeographicHigh"); - Hanging = Dlfcn.GetStringConstant (handle, "kCTBaselineClassHanging"); - Math = Dlfcn.GetStringConstant (handle, "kCTBaselineClassMath"); - } -#endif - public static NSString? ToNSString (CTBaselineClass key) { switch (key) { @@ -108,18 +88,6 @@ public enum CTBaselineFont { } static partial class CTBaselineFontID { -#if !NET - public static readonly NSString? Reference; - public static readonly NSString? Original; - - static CTBaselineFontID () - { - var handle = Libraries.CoreText.Handle; - Reference = Dlfcn.GetStringConstant (handle, "kCTBaselineReferenceFont"); - Original = Dlfcn.GetStringConstant (handle, "kCTBaselineOriginalFont"); - } -#endif // !NET - public static NSString? ToNSString (CTBaselineFont key) { switch (key) { diff --git a/src/CoreText/CTFont.cs b/src/CoreText/CTFont.cs index 5fd0c221c043..3f57726d4994 100644 --- a/src/CoreText/CTFont.cs +++ b/src/CoreText/CTFont.cs @@ -42,10 +42,6 @@ using CGGlyph = System.UInt16; -#if !NET -using NativeHandle = System.IntPtr; -#endif - namespace CoreText { [Flags] @@ -56,21 +52,13 @@ public enum CTFontOptions : ulong { Default = 0, /// Prevents font activation. PreventAutoActivation = 1 << 0, -#if NET [SupportedOSPlatform ("tvos16.0")] [SupportedOSPlatform ("macos13.0")] [SupportedOSPlatform ("ios16.0")] [SupportedOSPlatform ("maccatalyst16.0")] -#else - [iOS (16, 0), TV (16, 0), MacCatalyst (16, 0), Mac (13, 0)] -#endif PreventAutoDownload = 1 << 1, /// Give preferences to Apple/System fonts. PreferSystemFont = 1 << 2, -#if !NET - [Obsolete ("This API is not available on this platform.")] - IncludeDisabled = 1 << 7, -#endif } // defined as uint32_t - /System/Library/Frameworks/CoreText.framework/Headers/CTFont.h @@ -288,7 +276,6 @@ public enum CTFontTable : uint { public enum CTFontTableOptions : uint { /// To be added. None = 0, -#if NET /// To be added. [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("macos")] @@ -297,9 +284,6 @@ public enum CTFontTableOptions : uint { [ObsoletedOSPlatform ("maccatalyst13.1")] [ObsoletedOSPlatform ("macos10.8")] [UnsupportedOSPlatform ("tvos")] -#else - [Deprecated (PlatformName.TvOS, 16, 0)] -#endif ExcludeSynthetic = (1 << 0), } @@ -311,7 +295,6 @@ public enum FontFeatureGroup { Ligatures = 1, /// To be added. CursiveConnection = 2, -#if NET /// Developers should not use this deprecated field. [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] @@ -319,10 +302,8 @@ public enum FontFeatureGroup { [SupportedOSPlatform ("tvos")] [ObsoletedOSPlatform ("macos10.7")] [ObsoletedOSPlatform ("ios6.0")] -#else - [Deprecated (PlatformName.iOS, 6, 0)] - [Deprecated (PlatformName.MacOSX, 10, 7)] -#endif + [ObsoletedOSPlatform ("tvos")] + [ObsoletedOSPlatform ("maccatalyst")] LetterCase = 3, /// To be added. VerticalSubstitution = 4, @@ -394,12 +375,10 @@ public enum FontFeatureGroup { CJKRomanSpacing = 103, } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontFeatures { public CTFontFeatures () @@ -473,12 +452,10 @@ public IEnumerable? Selectors { } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontFeatureSelectors { public CTFontFeatureSelectors () @@ -503,8 +480,10 @@ internal static CTFontFeatureSelectors Create (FontFeatureGroup featureGroup, NS case FontFeatureGroup.CursiveConnection: return new CTFontFeatureCursiveConnection (dictionary); #pragma warning disable 618 +#pragma warning disable CA1422 // This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'CTFontFeatureLetterCase' is obsoleted on: 'ios' 6.0 and later, 'maccatalyst' 6.0 and later, 'macOS/OSX' 10.7 and later. case FontFeatureGroup.LetterCase: return new CTFontFeatureLetterCase (dictionary); +#pragma warning restore CA1422 #pragma warning restore 618 case FontFeatureGroup.VerticalSubstitution: return new CTFontFeatureVerticalSubstitutionConnection (dictionary); @@ -632,12 +611,10 @@ public bool Setting { } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontFeatureAllTypographicFeatures : CTFontFeatureSelectors { public enum Selector { /// To be added. @@ -661,12 +638,10 @@ public Selector Feature { } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontFeatureLigatures : CTFontFeatureSelectors { public enum Selector { /// To be added. @@ -730,17 +705,14 @@ public Selector Feature { } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] [ObsoletedOSPlatform ("macos10.7")] [ObsoletedOSPlatform ("ios6.0")] -#else - [Deprecated (PlatformName.iOS, 6, 0)] - [Deprecated (PlatformName.MacOSX, 10, 7)] -#endif + [ObsoletedOSPlatform ("tvos")] + [ObsoletedOSPlatform ("maccatalyst")] public class CTFontFeatureLetterCase : CTFontFeatureSelectors { public enum Selector { /// To be added. @@ -772,12 +744,10 @@ public Selector Feature { } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontFeatureCursiveConnection : CTFontFeatureSelectors { public enum Selector { /// To be added. @@ -803,12 +773,10 @@ public Selector Feature { } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontFeatureVerticalSubstitutionConnection : CTFontFeatureSelectors { public enum Selector { /// To be added. @@ -832,12 +800,10 @@ public Selector Feature { } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontFeatureLinguisticRearrangementConnection : CTFontFeatureSelectors { public enum Selector { /// To be added. @@ -861,12 +827,10 @@ public Selector Feature { } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontFeatureNumberSpacing : CTFontFeatureSelectors { public enum Selector { /// To be added. @@ -894,12 +858,10 @@ public Selector Feature { } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontFeatureSmartSwash : CTFontFeatureSelectors { public enum Selector { /// To be added. @@ -939,12 +901,10 @@ public Selector Feature { } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontFeatureDiacritics : CTFontFeatureSelectors { public enum Selector { /// To be added. @@ -970,12 +930,10 @@ public Selector Feature { } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontFeatureVerticalPosition : CTFontFeatureSelectors { public enum Selector { /// To be added. @@ -1005,12 +963,10 @@ public Selector Feature { } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontFeatureFractions : CTFontFeatureSelectors { public enum Selector { /// To be added. @@ -1036,12 +992,10 @@ public Selector Feature { } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontFeatureOverlappingCharacters : CTFontFeatureSelectors { public enum Selector { /// To be added. @@ -1065,12 +1019,10 @@ public Selector Feature { } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontFeatureTypographicExtras : CTFontFeatureSelectors { public enum Selector { /// To be added. @@ -1114,12 +1066,10 @@ public Selector Feature { } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontFeatureMathematicalExtras : CTFontFeatureSelectors { public enum Selector { /// To be added. @@ -1163,12 +1113,10 @@ public Selector Feature { } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontFeatureOrnamentSets : CTFontFeatureSelectors { public enum Selector { /// To be added. @@ -1202,12 +1150,10 @@ public Selector Feature { } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontFeatureCharacterAlternatives : CTFontFeatureSelectors { public enum Selector { /// To be added. @@ -1229,12 +1175,10 @@ public Selector Feature { } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontFeatureDesignComplexity : CTFontFeatureSelectors { public enum Selector { /// To be added. @@ -1264,12 +1208,10 @@ public Selector Feature { } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontFeatureStyleOptions : CTFontFeatureSelectors { public enum Selector { /// To be added. @@ -1301,12 +1243,10 @@ public Selector Feature { } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontFeatureCharacterShape : CTFontFeatureSelectors { public enum Selector { /// To be added. @@ -1356,12 +1296,10 @@ public Selector Feature { } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontFeatureNumberCase : CTFontFeatureSelectors { public enum Selector { /// To be added. @@ -1385,12 +1323,10 @@ public Selector Feature { } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontFeatureTextSpacing : CTFontFeatureSelectors { public enum Selector { /// To be added. @@ -1424,12 +1360,10 @@ public Selector Feature { } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontFeatureTransliteration : CTFontFeatureSelectors { public enum Selector { /// To be added. @@ -1469,12 +1403,10 @@ public Selector Feature { } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontFeatureAnnotation : CTFontFeatureSelectors { public enum Selector { /// To be added. @@ -1516,12 +1448,10 @@ public Selector Feature { } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontFeatureKanaSpacing : CTFontFeatureSelectors { public enum Selector { /// To be added. @@ -1545,12 +1475,10 @@ public Selector Feature { } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontFeatureIdeographicSpacing : CTFontFeatureSelectors { public enum Selector { /// To be added. @@ -1576,12 +1504,10 @@ public Selector Feature { } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontFeatureUnicodeDecomposition : CTFontFeatureSelectors { public enum Selector { /// To be added. @@ -1613,15 +1539,12 @@ public Selector Feature { } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontFeatureRubyKana : CTFontFeatureSelectors { public enum Selector { -#if NET /// Developers should not use this deprecated field. [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("macos")] @@ -1629,12 +1552,7 @@ public enum Selector { [UnsupportedOSPlatform ("maccatalyst")] [ObsoletedOSPlatform ("macos10.8")] [ObsoletedOSPlatform ("ios5.1")] -#else - [Deprecated (PlatformName.iOS, 5, 1)] - [Deprecated (PlatformName.MacOSX, 10, 8)] -#endif NoRubyKana = 0, -#if NET /// To be added. [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("macos")] @@ -1642,10 +1560,6 @@ public enum Selector { [UnsupportedOSPlatform ("maccatalyst")] [ObsoletedOSPlatform ("macos10.8")] [ObsoletedOSPlatform ("ios5.1")] -#else - [Deprecated (PlatformName.iOS, 5, 1)] - [Deprecated (PlatformName.MacOSX, 10, 8)] -#endif RubyKana = 1, /// To be added. RubyKanaOn = 2, @@ -1668,12 +1582,10 @@ public Selector Feature { } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontFeatureCJKSymbolAlternatives : CTFontFeatureSelectors { public enum Selector { /// To be added. @@ -1705,12 +1617,10 @@ public Selector Feature { } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontFeatureIdeographicAlternatives : CTFontFeatureSelectors { public enum Selector { /// To be added. @@ -1742,12 +1652,10 @@ public Selector Feature { } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontFeatureCJKVerticalRomanPlacement : CTFontFeatureSelectors { public enum Selector { /// To be added. @@ -1771,15 +1679,12 @@ public Selector Feature { } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontFeatureItalicCJKRoman : CTFontFeatureSelectors { public enum Selector { -#if NET /// To be added. [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("macos")] @@ -1787,12 +1692,7 @@ public enum Selector { [UnsupportedOSPlatform ("maccatalyst")] [ObsoletedOSPlatform ("macos10.8")] [ObsoletedOSPlatform ("ios5.1")] -#else - [Deprecated (PlatformName.iOS, 5, 1)] - [Deprecated (PlatformName.MacOSX, 10, 8)] -#endif NoCJKItalicRoman = 0, -#if NET /// Developers should not use this deprecated field. [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("macos")] @@ -1800,10 +1700,6 @@ public enum Selector { [UnsupportedOSPlatform ("maccatalyst")] [ObsoletedOSPlatform ("macos10.8")] [ObsoletedOSPlatform ("ios5.1")] -#else - [Deprecated (PlatformName.iOS, 5, 1)] - [Deprecated (PlatformName.MacOSX, 10, 8)] -#endif CJKItalicRoman = 1, /// To be added. CJKItalicRomanOn = 2, @@ -1826,12 +1722,10 @@ public Selector Feature { } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontFeatureCaseSensitiveLayout : CTFontFeatureSelectors { public enum Selector { /// To be added. @@ -1859,12 +1753,10 @@ public Selector Feature { } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontFeatureAlternateKana : CTFontFeatureSelectors { public enum Selector { /// To be added. @@ -1892,12 +1784,10 @@ public Selector Feature { } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontFeatureStylisticAlternatives : CTFontFeatureSelectors { public enum Selector { /// To be added. @@ -1999,12 +1889,10 @@ public Selector Feature { } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontFeatureContextualAlternates : CTFontFeatureSelectors { public enum Selector { /// To be added. @@ -2036,12 +1924,10 @@ public Selector Feature { } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontFeatureLowerCase : CTFontFeatureSelectors { public enum Selector { /// To be added. @@ -2067,12 +1953,10 @@ public Selector Feature { } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontFeatureUpperCase : CTFontFeatureSelectors { public enum Selector { /// To be added. @@ -2098,12 +1982,10 @@ public Selector Feature { } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontFeatureCJKRomanSpacing : CTFontFeatureSelectors { public enum Selector { /// To be added. @@ -2131,12 +2013,10 @@ public Selector Feature { } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontFeatureSettings { internal CTFontFeatureSettings (NSDictionary dictionary) @@ -2170,12 +2050,10 @@ public int FeatureWeak { } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontVariationAxes { public CTFontVariationAxes () @@ -2235,7 +2113,6 @@ public string? Name { set { Adapter.SetValue (Dictionary, CTFontVariationAxisKey.Name, value); } } -#if NET /// To be added. /// To be added. /// To be added. @@ -2243,19 +2120,16 @@ public string? Name { [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] [SupportedOSPlatform ("maccatalyst")] -#endif public bool? Hidden { get { return Adapter.GetBoolValue (Dictionary, CTFontVariationAxisKey.Hidden); } set { Adapter.SetValue (Dictionary, CTFontVariationAxisKey.Hidden, value); } } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontVariation { public CTFontVariation () @@ -2388,23 +2262,19 @@ static IntPtr Create (string name, nfloat size, CTFontOptions options) } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public CTFont (string name, nfloat size, CTFontOptions options) : base (Create (name, size, options), true) { } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif [DllImport (Constants.CoreTextLibrary)] unsafe static extern IntPtr CTFontCreateWithNameAndOptions (IntPtr name, nfloat size, CGAffineTransform* matrix, nuint options); @@ -2426,12 +2296,10 @@ static IntPtr Create (string name, nfloat size, ref CGAffineTransform matrix, CT } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public CTFont (string name, nfloat size, ref CGAffineTransform matrix, CTFontOptions options) : base (Create (name, size, ref matrix, options), true) { @@ -2451,23 +2319,19 @@ static IntPtr Create (CTFontDescriptor descriptor, nfloat size, CTFontOptions op return handle; } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public CTFont (CTFontDescriptor descriptor, nfloat size, CTFontOptions options) : base (Create (descriptor, size, options), true) { } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif [DllImport (Constants.CoreTextLibrary)] unsafe static extern IntPtr CTFontCreateWithFontDescriptorAndOptions (IntPtr descriptor, nfloat size, CGAffineTransform* matrix, nuint options); @@ -2485,12 +2349,10 @@ static IntPtr Create (CTFontDescriptor descriptor, nfloat size, CTFontOptions op return handle; } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public CTFont (CTFontDescriptor descriptor, nfloat size, CTFontOptions options, ref CGAffineTransform matrix) : base (Create (descriptor, size, options, ref matrix), true) { @@ -2679,15 +2541,10 @@ public CTFont (CTFontUIFontType uiType, nfloat size, string language) } } -#if NET [SupportedOSPlatform ("ios13.0")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos13.0")] [SupportedOSPlatform ("maccatalyst")] -#else - [iOS (13, 0)] - [TV (13, 0)] -#endif [DllImport (Constants.CoreTextLibrary)] static extern /* CTFontRef */ IntPtr CTFontCreateForStringWithLanguage ( /* CTFontRef */ IntPtr currentFont, @@ -2695,15 +2552,10 @@ public CTFont (CTFontUIFontType uiType, nfloat size, string language) NSRange range, /* CFStringRef _Nullable */ IntPtr language); -#if NET [SupportedOSPlatform ("ios13.0")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos13.0")] [SupportedOSPlatform ("maccatalyst")] -#else - [iOS (13, 0)] - [TV (13, 0)] -#endif public CTFont? ForString (string value, NSRange range, string? language) { if (value is null) @@ -2920,27 +2772,17 @@ public bool GetGlyphsForCharacters (char [] characters, CGGlyph [] glyphs) return GetGlyphsForCharacters (characters, glyphs, Math.Min (characters.Length, glyphs.Length)); } -#if NET [SupportedOSPlatform ("tvos14.0")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios14.0")] [SupportedOSPlatform ("maccatalyst")] -#else - [TV (14, 0)] - [iOS (14, 0)] -#endif [DllImport (Constants.CoreTextLibrary)] static extern unsafe /* CFStringRef _Nullable */ IntPtr CTFontCopyNameForGlyph (/* CTFontRef */ IntPtr font, CGGlyph glyph); -#if NET [SupportedOSPlatform ("tvos14.0")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios14.0")] [SupportedOSPlatform ("maccatalyst")] -#else - [TV (14, 0)] - [iOS (14, 0)] -#endif public string? GetGlyphName (CGGlyph glyph) { return CFString.FromHandle (CTFontCopyNameForGlyph (Handle, glyph), releaseHandle: true); @@ -3320,14 +3162,10 @@ public CTFontTable [] GetAvailableTables (CTFontTableOptions options) #endregion -#if NET [SupportedOSPlatform ("ios18.0")] [SupportedOSPlatform ("maccatalyst18.0")] [SupportedOSPlatform ("macos15.0")] [SupportedOSPlatform ("tvos18.0")] -#else - [TV (18, 0), Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)] -#endif [DllImport (Constants.CoreTextLibrary)] extern static /* CGRect */ CGRect CTFontGetTypographicBoundsForAdaptiveImageProvider ( /* CTFontRef */ IntPtr font, @@ -3336,14 +3174,10 @@ public CTFontTable [] GetAvailableTables (CTFontTableOptions options) /// Computes metrics that clients performing their own typesetting of an adaptive image glyph need. /// The typographic bounds in points expressed as a rectangle, where the rectangle's Width property corresponds to the advance width, the rectangle's Bottom property corresponds to the ascent (above the baseline), and Top property corresponds to the descent (below the baseline). /// The adaptive image provider used during the computation. If null, then default results will be returned, on the assumption that an image is not yet available. -#if NET [SupportedOSPlatform ("ios18.0")] [SupportedOSPlatform ("maccatalyst18.0")] [SupportedOSPlatform ("macos15.0")] [SupportedOSPlatform ("tvos18.0")] -#else - [TV (18, 0), Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)] -#endif public CGRect GetTypographicBoundsForAdaptiveImageProvider (ICTAdaptiveImageProviding? provider) { CGRect result = CTFontGetTypographicBoundsForAdaptiveImageProvider (Handle, provider.GetHandle ()); @@ -3351,14 +3185,10 @@ public CGRect GetTypographicBoundsForAdaptiveImageProvider (ICTAdaptiveImageProv return result; } -#if NET [SupportedOSPlatform ("ios18.0")] [SupportedOSPlatform ("maccatalyst18.0")] [SupportedOSPlatform ("macos15.0")] [SupportedOSPlatform ("tvos18.0")] -#else - [TV (18, 0), Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)] -#endif [DllImport (Constants.CoreTextLibrary)] extern static void CTFontDrawImageFromAdaptiveImageProviderAtPoint ( /* CTFontRef */ IntPtr font, @@ -3370,14 +3200,10 @@ extern static void CTFontDrawImageFromAdaptiveImageProviderAtPoint ( /// The adaptive image provider used during the rendering. /// The adaptive image glyph is rendered relative to this point. /// The where the adaptive image glyph is drawn. -#if NET [SupportedOSPlatform ("ios18.0")] [SupportedOSPlatform ("maccatalyst18.0")] [SupportedOSPlatform ("macos15.0")] [SupportedOSPlatform ("tvos18.0")] -#else - [TV (18, 0), Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)] -#endif public void DrawImage (ICTAdaptiveImageProviding provider, CGPoint point, CGContext context) { CTFontDrawImageFromAdaptiveImageProviderAtPoint (Handle, provider.GetNonNullHandle (nameof (provider)), point, context.GetNonNullHandle (nameof (context))); @@ -3385,14 +3211,10 @@ public void DrawImage (ICTAdaptiveImageProviding provider, CGPoint point, CGCont GC.KeepAlive (context); } -#if NET [SupportedOSPlatform ("ios13.0")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos13.0")] -#else - [TV (13, 0), iOS (13, 0), MacCatalyst (13, 0)] -#endif [DllImport (Constants.CoreTextLibrary)] extern static byte CTFontHasTable ( /* CTFontRef */ IntPtr font, @@ -3402,14 +3224,10 @@ extern static byte CTFontHasTable ( /// The table identifier to check for. /// Whether the table is present in the font or not. /// The check behaves as if was specified. -#if NET [SupportedOSPlatform ("ios13.0")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos13.0")] -#else - [TV (13, 0), iOS (13, 0), MacCatalyst (13, 0)] -#endif public bool HasTable (CTFontTable tag) { return CTFontHasTable (GetCheckedHandle (), tag) != 0; diff --git a/src/CoreText/CTFontCollection.cs b/src/CoreText/CTFontCollection.cs index 61a6b6bd1b79..14a1dce92d3b 100644 --- a/src/CoreText/CTFontCollection.cs +++ b/src/CoreText/CTFontCollection.cs @@ -37,35 +37,13 @@ using CoreFoundation; using CoreGraphics; -#if NET using CFIndex = System.IntPtr; -#else -using CFIndex = System.nint; -#endif - -#if !NET -using NativeHandle = System.IntPtr; -#endif namespace CoreText { - -#if !NET - public static class CTFontCollectionOptionKey { - public static readonly NSString? RemoveDuplicates; - - static CTFontCollectionOptionKey () - { - RemoveDuplicates = Dlfcn.GetStringConstant (Libraries.CoreText.Handle, "kCTFontCollectionRemoveDuplicatesOption"); - } - } -#endif - -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontCollectionOptions { public CTFontCollectionOptions () @@ -119,12 +97,10 @@ public static IntPtr GetHandle (this CTFontCollectionOptions? @self) } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontCollection : NativeObject { [Preserve (Conditional = true)] internal CTFontCollection (NativeHandle handle, bool owns) @@ -180,21 +156,17 @@ public CTFontDescriptor [] GetMatchingFontDescriptors () return CFArray.ArrayFromHandleFunc (cfArrayRef, fd => new CTFontDescriptor (fd, false), true)!; } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("tvos")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] -#endif [DllImport (Constants.CoreTextLibrary)] static extern IntPtr CTFontCollectionCreateMatchingFontDescriptorsWithOptions (IntPtr collection, IntPtr options); -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("tvos")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] -#endif public CTFontDescriptor [] GetMatchingFontDescriptors (CTFontCollectionOptions? options) { var cfArrayRef = CTFontCollectionCreateMatchingFontDescriptorsWithOptions (Handle, options.GetHandle ()); @@ -203,24 +175,12 @@ public CTFontDescriptor [] GetMatchingFontDescriptors (CTFontCollectionOptions? return CFArray.ArrayFromHandleFunc (cfArrayRef, fd => new CTFontDescriptor (fd, false), true)!; } -#if NET [DllImport (Constants.CoreTextLibrary)] static unsafe extern IntPtr CTFontCollectionCreateMatchingFontDescriptorsSortedWithCallback ( IntPtr collection, delegate* unmanaged sortCallback, IntPtr refCon); -#else - [DllImport (Constants.CoreTextLibrary)] - static extern IntPtr CTFontCollectionCreateMatchingFontDescriptorsSortedWithCallback ( - IntPtr collection, CTFontCollectionSortDescriptorsCallback sortCallback, IntPtr refCon); - - delegate CFIndex CTFontCollectionSortDescriptorsCallback (IntPtr first, IntPtr second, IntPtr refCon); -#endif -#if NET [UnmanagedCallersOnly] -#else - [MonoPInvokeCallback (typeof (CTFontCollectionSortDescriptorsCallback))] -#endif static CFIndex CompareDescriptors (IntPtr first, IntPtr second, IntPtr context) { GCHandle c = GCHandle.FromIntPtr (context); @@ -236,19 +196,12 @@ static CFIndex CompareDescriptors (IntPtr first, IntPtr second, IntPtr context) GCHandle comparison = GCHandle.Alloc (comparer); try { IntPtr cfArrayRef; -#if NET unsafe { cfArrayRef = CTFontCollectionCreateMatchingFontDescriptorsSortedWithCallback ( Handle, &CompareDescriptors, GCHandle.ToIntPtr (comparison)); } -#else - cfArrayRef = CTFontCollectionCreateMatchingFontDescriptorsSortedWithCallback ( - Handle, - new CTFontCollectionSortDescriptorsCallback (CompareDescriptors), - GCHandle.ToIntPtr (comparison)); -#endif if (cfArrayRef == IntPtr.Zero) return Array.Empty (); return CFArray.ArrayFromHandleFunc (cfArrayRef, fd => new CTFontDescriptor (fd, false), true)!; diff --git a/src/CoreText/CTFontDescriptor.cs b/src/CoreText/CTFontDescriptor.cs index e75b38bc6a7a..d6847c2fd0ea 100644 --- a/src/CoreText/CTFontDescriptor.cs +++ b/src/CoreText/CTFontDescriptor.cs @@ -40,10 +40,6 @@ using CoreGraphics; using Foundation; -#if !NET -using NativeHandle = System.IntPtr; -#endif - namespace CoreText { // defined as uint32_t - /System/Library/Frameworks/CoreText.framework/Headers/CTFontDescriptor.h @@ -110,66 +106,10 @@ public enum CTFontDescriptorMatchingState : uint { FailedWithError, } -#if !NET - public static class CTFontDescriptorAttributeKey { - public static readonly NSString? Url; - public static readonly NSString? Name; - public static readonly NSString? DisplayName; - public static readonly NSString? FamilyName; - public static readonly NSString? StyleName; - public static readonly NSString? Traits; - public static readonly NSString? Variation; - public static readonly NSString? Size; - public static readonly NSString? Matrix; - public static readonly NSString? CascadeList; - public static readonly NSString? CharacterSet; - public static readonly NSString? Languages; - public static readonly NSString? BaselineAdjust; - public static readonly NSString? MacintoshEncodings; - public static readonly NSString? Features; - public static readonly NSString? FeatureSettings; - public static readonly NSString? FixedAdvance; - public static readonly NSString? FontOrientation; - public static readonly NSString? FontFormat; - public static readonly NSString? RegistrationScope; - public static readonly NSString? Priority; - public static readonly NSString? Enabled; - - static CTFontDescriptorAttributeKey () - { - var handle = Libraries.CoreText.Handle; - Url = Dlfcn.GetStringConstant (handle, "kCTFontURLAttribute"); - Name = Dlfcn.GetStringConstant (handle, "kCTFontNameAttribute"); - DisplayName = Dlfcn.GetStringConstant (handle, "kCTFontDisplayNameAttribute"); - FamilyName = Dlfcn.GetStringConstant (handle, "kCTFontFamilyNameAttribute"); - StyleName = Dlfcn.GetStringConstant (handle, "kCTFontStyleNameAttribute"); - Traits = Dlfcn.GetStringConstant (handle, "kCTFontTraitsAttribute"); - Variation = Dlfcn.GetStringConstant (handle, "kCTFontVariationAttribute"); - Size = Dlfcn.GetStringConstant (handle, "kCTFontSizeAttribute"); - Matrix = Dlfcn.GetStringConstant (handle, "kCTFontMatrixAttribute"); - CascadeList = Dlfcn.GetStringConstant (handle, "kCTFontCascadeListAttribute"); - CharacterSet = Dlfcn.GetStringConstant (handle, "kCTFontCharacterSetAttribute"); - Languages = Dlfcn.GetStringConstant (handle, "kCTFontLanguagesAttribute"); - BaselineAdjust = Dlfcn.GetStringConstant (handle, "kCTFontBaselineAdjustAttribute"); - MacintoshEncodings = Dlfcn.GetStringConstant (handle, "kCTFontMacintoshEncodingsAttribute"); - Features = Dlfcn.GetStringConstant (handle, "kCTFontFeaturesAttribute"); - FeatureSettings = Dlfcn.GetStringConstant (handle, "kCTFontFeatureSettingsAttribute"); - FixedAdvance = Dlfcn.GetStringConstant (handle, "kCTFontFixedAdvanceAttribute"); - FontOrientation = Dlfcn.GetStringConstant (handle, "kCTFontOrientationAttribute"); - FontFormat = Dlfcn.GetStringConstant (handle, "kCTFontFormatAttribute"); - RegistrationScope = Dlfcn.GetStringConstant (handle, "kCTFontRegistrationScopeAttribute"); - Priority = Dlfcn.GetStringConstant (handle, "kCTFontPriorityAttribute"); - Enabled = Dlfcn.GetStringConstant (handle, "kCTFontEnabledAttribute"); - } - } -#endif // !NET - -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontDescriptorAttributes { public CTFontDescriptorAttributes () @@ -549,7 +489,7 @@ public bool Enabled { } #endif // !XAMCORE_5_0 -#if NET && (__IOS__ || __MACCATALYST__) +#if __IOS__ || __MACCATALYST__ [SupportedOSPlatform ("ios13.0")] [UnsupportedOSPlatform ("tvos")] [SupportedOSPlatform ("maccatalyst")] @@ -561,12 +501,10 @@ public string? RegistrationUserInfo { #endif } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public partial class CTFontDescriptor : NativeObject { [Preserve (Conditional = true)] internal CTFontDescriptor (NativeHandle handle, bool owns) @@ -937,25 +875,16 @@ public CTFontDescriptor [] GetMatchingFontDescriptors (NSSet? mandatoryAttribute return Runtime.GetNSObject (handle, true); } #endregion -#if NET [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("tvos")] -#endif [DllImport (Constants.CoreTextLibrary)] static unsafe extern byte CTFontDescriptorMatchFontDescriptorsWithProgressHandler (IntPtr descriptors, IntPtr mandatoryAttributes, BlockLiteral* progressBlock); public delegate bool CTFontDescriptorProgressHandler (CTFontDescriptorMatchingState state, CTFontDescriptorMatchingProgress progress); -#if !NET - delegate byte ct_font_desctiptor_progress_handler_t (IntPtr block, CTFontDescriptorMatchingState state, IntPtr progress); - static ct_font_desctiptor_progress_handler_t static_MatchFontDescriptorsHandler = MatchFontDescriptorsHandler; - - [MonoPInvokeCallback (typeof (ct_font_desctiptor_progress_handler_t))] -#else [UnmanagedCallersOnly] -#endif static byte MatchFontDescriptorsHandler (IntPtr block, CTFontDescriptorMatchingState state, IntPtr progress) { var del = BlockLiteral.GetTarget (block); @@ -968,12 +897,10 @@ static byte MatchFontDescriptorsHandler (IntPtr block, CTFontDescriptorMatchingS return 0; } -#if NET [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("tvos")] -#endif [BindingImpl (BindingImplOptions.Optimizable)] public static bool MatchFontDescriptors (CTFontDescriptor [] descriptors, NSSet? mandatoryAttributes, CTFontDescriptorProgressHandler progressHandler) { @@ -984,13 +911,8 @@ public static bool MatchFontDescriptors (CTFontDescriptor [] descriptors, NSSet? ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (progressHandler)); unsafe { -#if NET delegate* unmanaged trampoline = &MatchFontDescriptorsHandler; using var block = new BlockLiteral (trampoline, progressHandler, typeof (CTFontDescriptor), nameof (MatchFontDescriptorsHandler)); -#else - using var block = new BlockLiteral (); - block.SetupBlockUnsafe (static_MatchFontDescriptorsHandler, progressHandler); -#endif using var descriptorsArray = NSArray.FromNSObjects (descriptors); var rv = CTFontDescriptorMatchFontDescriptorsWithProgressHandler (descriptorsArray.GetHandle (), mandatoryAttributes.GetHandle (), &block); GC.KeepAlive (descriptorsArray); diff --git a/src/CoreText/CTFontManager.cs b/src/CoreText/CTFontManager.cs index 9eb7b61000d8..fc1882a5ba7a 100644 --- a/src/CoreText/CTFontManager.cs +++ b/src/CoreText/CTFontManager.cs @@ -50,32 +50,17 @@ public enum CTFontManagerScope : uint { None = 0, /// To be added. Process = 1, -#if NET [SupportedOSPlatform ("ios13.0")] [SupportedOSPlatform ("tvos13.0")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] -#else - [iOS (13, 0)] - [TV (13, 0)] -#endif Persistent = 2, -#if NET /// To be added. [UnsupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [UnsupportedOSPlatform ("ios")] [UnsupportedOSPlatform ("tvos")] -#else - [NoiOS] - [NoTV] -#endif Session = 3, -#if !NET - [NoiOS] - [NoTV] - User = Persistent, -#endif } // defined as uint32_t - /System/Library/Frameworks/CoreText.framework/Headers/CTFontManager.h @@ -86,16 +71,15 @@ public enum CTFontManagerAutoActivation : uint { Disabled = 1, /// To be added. Enabled = 2, -#if NET /// Developers should not use this deprecated field. It's now treated as 'Default'. [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] + [ObsoletedOSPlatform ("ios", "It's now treated as 'Default'.")] + [ObsoletedOSPlatform ("maccatalyst", "It's now treated as 'Default'.")] + [ObsoletedOSPlatform ("tvos", "It's now treated as 'Default'.")] [ObsoletedOSPlatform ("macos10.13", "It's now treated as 'Default'.")] -#else - [Deprecated (PlatformName.MacOSX, 10, 13, message: "It's now treated as 'Default'.")] -#endif PromptUser = 3, } @@ -105,16 +89,11 @@ public partial class CTFontManager { [DllImport (Constants.CoreTextLibrary)] static extern byte CTFontManagerIsSupportedFont (IntPtr url); -#if NET [UnsupportedOSPlatform ("maccatalyst")] [UnsupportedOSPlatform ("tvos")] [UnsupportedOSPlatform ("ios")] [SupportedOSPlatform ("macos")] [ObsoletedOSPlatform ("macos10.6")] -#else - [Deprecated (PlatformName.MacOSX, 10, 6)] - [Unavailable (PlatformName.iOS)] -#endif public static bool IsFontSupported (NSUrl url) { if (url is null) @@ -174,7 +153,6 @@ static NSArray EnsureNonNullArray (object [] items, string name) } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] @@ -182,15 +160,10 @@ static NSArray EnsureNonNullArray (object [] items, string name) [ObsoletedOSPlatform ("macos10.15")] [ObsoletedOSPlatform ("tvos13.0")] [ObsoletedOSPlatform ("ios13.0")] -#else - [Deprecated (PlatformName.MacOSX, 10, 15)] - [Deprecated (PlatformName.iOS, 13, 0)] - [Deprecated (PlatformName.TvOS, 13, 0)] -#endif + [ObsoletedOSPlatform ("maccatalyst13.1")] [DllImport (Constants.CoreTextLibrary)] unsafe static extern byte CTFontManagerRegisterFontsForURLs (IntPtr arrayRef, CTFontManagerScope scope, IntPtr* error_array); -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] @@ -198,11 +171,7 @@ static NSArray EnsureNonNullArray (object [] items, string name) [ObsoletedOSPlatform ("macos10.15", "Use 'RegisterFonts' instead.")] [ObsoletedOSPlatform ("tvos13.0", "Use 'RegisterFonts' instead.")] [ObsoletedOSPlatform ("ios13.0", "Use 'RegisterFonts' instead.")] -#else - [Deprecated (PlatformName.MacOSX, 10, 15, message: "Use 'RegisterFonts' instead.")] - [Deprecated (PlatformName.iOS, 13, 0, message: "Use 'RegisterFonts' instead.")] - [Deprecated (PlatformName.TvOS, 13, 0, message: "Use 'RegisterFonts' instead.")] -#endif + [ObsoletedOSPlatform ("maccatalyst13.1", "Use 'RegisterFonts' instead.")] public static NSError []? RegisterFontsForUrl (NSUrl [] fontUrls, CTFontManagerScope scope) { using (var arr = EnsureNonNullArray (fontUrls, nameof (fontUrls))) { @@ -216,25 +185,9 @@ static NSArray EnsureNonNullArray (object [] items, string name) } } -#if NET - // [SupportedOSPlatform ("tvos13.0")] - Not valid on delegate declaration - // [SupportedOSPlatform ("macos")] - // [SupportedOSPlatform ("ios13.0")] - // [SupportedOSPlatform ("maccatalyst")] -#else - [TV (13, 0)] - [iOS (13, 0)] -#endif public delegate bool CTFontRegistrationHandler (NSError [] errors, bool done); -#if !NET - internal delegate byte InnerRegistrationHandler (IntPtr block, IntPtr errors, byte done); - static readonly InnerRegistrationHandler callback = TrampolineRegistrationHandler; - - [MonoPInvokeCallback (typeof (InnerRegistrationHandler))] -#else [UnmanagedCallersOnly] -#endif static unsafe byte TrampolineRegistrationHandler (IntPtr block, /* NSArray */ IntPtr errors, byte done) { var del = BlockLiteral.GetTarget (block); @@ -245,27 +198,17 @@ static unsafe byte TrampolineRegistrationHandler (IntPtr block, /* NSArray */ In return rv ? (byte) 1 : (byte) 0; } -#if NET [SupportedOSPlatform ("tvos13.0")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios13.0")] [SupportedOSPlatform ("maccatalyst")] -#else - [TV (13, 0)] - [iOS (13, 0)] -#endif [DllImport (Constants.CoreTextLibrary)] unsafe static extern void CTFontManagerRegisterFontURLs (/* CFArrayRef */ IntPtr fontUrls, CTFontManagerScope scope, byte enabled, BlockLiteral* registrationHandler); -#if NET [SupportedOSPlatform ("tvos13.0")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios13.0")] [SupportedOSPlatform ("maccatalyst")] -#else - [TV (13, 0)] - [iOS (13, 0)] -#endif [BindingImpl (BindingImplOptions.Optimizable)] public static void RegisterFonts (NSUrl [] fontUrls, CTFontManagerScope scope, bool enabled, CTFontRegistrationHandler registrationHandler) { @@ -277,13 +220,8 @@ public static void RegisterFonts (NSUrl [] fontUrls, CTFontManagerScope scope, b } } else { unsafe { -#if NET delegate* unmanaged trampoline = &TrampolineRegistrationHandler; using var block = new BlockLiteral (trampoline, registrationHandler, typeof (CTFontManager), nameof (TrampolineRegistrationHandler)); -#else - using var block = new BlockLiteral (); - block.SetupBlockUnsafe (callback, registrationHandler); -#endif CTFontManagerRegisterFontURLs (arr.Handle, scope, enabled.AsByte (), &block); } } @@ -316,7 +254,6 @@ public static void RegisterFonts (NSUrl [] fontUrls, CTFontManagerScope scope, b } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] @@ -324,15 +261,9 @@ public static void RegisterFonts (NSUrl [] fontUrls, CTFontManagerScope scope, b [ObsoletedOSPlatform ("macos10.15")] [ObsoletedOSPlatform ("tvos13.0")] [ObsoletedOSPlatform ("ios13.0")] -#else - [Deprecated (PlatformName.MacOSX, 10, 15)] - [Deprecated (PlatformName.iOS, 13, 0)] - [Deprecated (PlatformName.TvOS, 13, 0)] -#endif [DllImport (Constants.CoreTextLibrary)] unsafe static extern byte CTFontManagerUnregisterFontsForURLs (IntPtr arrayRef, CTFontManagerScope scope, IntPtr* error_array); -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] @@ -340,11 +271,7 @@ public static void RegisterFonts (NSUrl [] fontUrls, CTFontManagerScope scope, b [ObsoletedOSPlatform ("macos10.15", "Use 'UnregisterFonts' instead.")] [ObsoletedOSPlatform ("tvos13.0", "Use 'UnregisterFonts' instead.")] [ObsoletedOSPlatform ("ios13.0", "Use 'UnregisterFonts' instead.")] -#else - [Deprecated (PlatformName.MacOSX, 10, 15, message: "Use 'UnregisterFonts' instead.")] - [Deprecated (PlatformName.iOS, 13, 0, message: "Use 'UnregisterFonts' instead.")] - [Deprecated (PlatformName.TvOS, 13, 0, message: "Use 'UnregisterFonts' instead.")] -#endif + [ObsoletedOSPlatform ("maccatalyst", "Use 'UnregisterFonts' instead.")] public static NSError []? UnregisterFontsForUrl (NSUrl [] fontUrls, CTFontManagerScope scope) { IntPtr error_array = IntPtr.Zero; @@ -358,27 +285,17 @@ public static void RegisterFonts (NSUrl [] fontUrls, CTFontManagerScope scope, b } } -#if NET [SupportedOSPlatform ("tvos13.0")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios13.0")] [SupportedOSPlatform ("maccatalyst")] -#else - [TV (13, 0)] - [iOS (13, 0)] -#endif [DllImport (Constants.CoreTextLibrary)] static extern unsafe void CTFontManagerUnregisterFontURLs (/* CFArrayRef */ IntPtr fontUrls, CTFontManagerScope scope, BlockLiteral* registrationHandler); -#if NET [SupportedOSPlatform ("tvos13.0")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios13.0")] [SupportedOSPlatform ("maccatalyst")] -#else - [TV (13, 0)] - [iOS (13, 0)] -#endif [BindingImpl (BindingImplOptions.Optimizable)] public unsafe static void UnregisterFonts (NSUrl [] fontUrls, CTFontManagerScope scope, CTFontRegistrationHandler registrationHandler) { @@ -387,34 +304,25 @@ public unsafe static void UnregisterFonts (NSUrl [] fontUrls, CTFontManagerScope CTFontManagerUnregisterFontURLs (arr.Handle, scope, null); GC.KeepAlive (arr); } else { -#if NET delegate* unmanaged trampoline = &TrampolineRegistrationHandler; using var block = new BlockLiteral (trampoline, registrationHandler, typeof (CTFontManager), nameof (TrampolineRegistrationHandler)); -#else - using var block = new BlockLiteral (); - block.SetupBlockUnsafe (callback, registrationHandler); -#endif CTFontManagerUnregisterFontURLs (arr.Handle, scope, &block); GC.KeepAlive (arr); } } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif [DllImport (Constants.CoreTextLibrary)] static extern /* CFArrayRef */ IntPtr CTFontManagerCreateFontDescriptorsFromURL (/* CFURLRef */ IntPtr fileURL); -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public static CTFontDescriptor [] GetFonts (NSUrl url) { if (url is null) @@ -434,7 +342,6 @@ public static CTFontDescriptor [] GetFonts (NSUrl url) } } -#if NET [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] [SupportedOSPlatform ("ios")] @@ -443,16 +350,9 @@ public static CTFontDescriptor [] GetFonts (NSUrl url) [ObsoletedOSPlatform ("tvos18.0", "Use 'CreateFontDescriptors' or 'RegisterFontsForUrl' instead.")] [ObsoletedOSPlatform ("ios18.0", "Use 'CreateFontDescriptors' or 'RegisterFontsForUrl' instead.")] [ObsoletedOSPlatform ("maccatalyst18.0", "Use 'CreateFontDescriptors' or 'RegisterFontsForUrl' instead.")] -#else - [Deprecated (PlatformName.iOS, 18, 0, message: "Use 'CreateFontDescriptors' or 'RegisterFontsForUrl' instead.")] - [Deprecated (PlatformName.MacCatalyst, 18, 0, message: "Use 'CreateFontDescriptors' or 'RegisterFontsForUrl' instead.")] - [Deprecated (PlatformName.TvOS, 18, 0, message: "Use 'CreateFontDescriptors' or 'RegisterFontsForUrl' instead.")] - [Deprecated (PlatformName.MacOSX, 15, 0, message: "Use 'CreateFontDescriptors' or 'RegisterFontsForUrl' instead.")] -#endif [DllImport (Constants.CoreTextLibrary)] unsafe static extern byte CTFontManagerRegisterGraphicsFont (IntPtr cgfont, IntPtr* error); -#if NET [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] [SupportedOSPlatform ("ios")] @@ -461,12 +361,6 @@ public static CTFontDescriptor [] GetFonts (NSUrl url) [ObsoletedOSPlatform ("tvos18.0", "Use 'CreateFontDescriptors' or 'RegisterFontsForUrl' instead.")] [ObsoletedOSPlatform ("ios18.0", "Use 'CreateFontDescriptors' or 'RegisterFontsForUrl' instead.")] [ObsoletedOSPlatform ("maccatalyst18.0", "Use 'CreateFontDescriptors' or 'RegisterFontsForUrl' instead.")] -#else - [Deprecated (PlatformName.iOS, 18, 0, message: "Use 'CreateFontDescriptors' or 'RegisterFontsForUrl' instead.")] - [Deprecated (PlatformName.MacCatalyst, 18, 0, message: "Use 'CreateFontDescriptors' or 'RegisterFontsForUrl' instead.")] - [Deprecated (PlatformName.TvOS, 18, 0, message: "Use 'CreateFontDescriptors' or 'RegisterFontsForUrl' instead.")] - [Deprecated (PlatformName.MacOSX, 15, 0, message: "Use 'CreateFontDescriptors' or 'RegisterFontsForUrl' instead.")] -#endif public static bool RegisterGraphicsFont (CGFont font, [NotNullWhen (true)] out NSError? error) { if (font is null) @@ -489,7 +383,6 @@ public static bool RegisterGraphicsFont (CGFont font, [NotNullWhen (true)] out N return ret; } -#if NET [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] [SupportedOSPlatform ("ios")] @@ -498,16 +391,9 @@ public static bool RegisterGraphicsFont (CGFont font, [NotNullWhen (true)] out N [ObsoletedOSPlatform ("tvos18.0")] [ObsoletedOSPlatform ("ios18.0")] [ObsoletedOSPlatform ("maccatalyst18.0")] -#else - [Deprecated (PlatformName.iOS, 18, 0)] - [Deprecated (PlatformName.MacCatalyst, 18, 0)] - [Deprecated (PlatformName.TvOS, 18, 0)] - [Deprecated (PlatformName.MacOSX, 15, 0)] -#endif [DllImport (Constants.CoreTextLibrary)] unsafe static extern byte CTFontManagerUnregisterGraphicsFont (IntPtr cgfont, IntPtr* error); -#if NET [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] [SupportedOSPlatform ("ios")] @@ -516,12 +402,6 @@ public static bool RegisterGraphicsFont (CGFont font, [NotNullWhen (true)] out N [ObsoletedOSPlatform ("tvos18.0")] [ObsoletedOSPlatform ("ios18.0")] [ObsoletedOSPlatform ("maccatalyst18.0")] -#else - [Deprecated (PlatformName.iOS, 18, 0)] - [Deprecated (PlatformName.MacCatalyst, 18, 0)] - [Deprecated (PlatformName.TvOS, 18, 0)] - [Deprecated (PlatformName.MacOSX, 15, 0)] -#endif public static bool UnregisterGraphicsFont (CGFont font, out NSError? error) { if (font is null) @@ -544,24 +424,12 @@ public static bool UnregisterGraphicsFont (CGFont font, out NSError? error) return ret; } -#if !NET - static CTFontManager () - { - var handle = Libraries.CoreText.Handle; -#pragma warning disable CS0618 // Type or member is obsolete - ErrorFontUrlsKey = Dlfcn.GetStringConstant (handle, "kCTFontManagerErrorFontURLsKey"); -#pragma warning restore CS0618 // Type or member is obsolete - } -#endif // !NET - static NSString? _RegisteredFontsChangedNotification; -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif static NSString? RegisteredFontsChangedNotification { get { if (_RegisteredFontsChangedNotification is null) @@ -570,11 +438,6 @@ static NSString? RegisteredFontsChangedNotification { } } -#if !NET - [Obsolete ("Use the 'CTFontManagerErrorKeys.FontUrlsKey' property instead.")] - public readonly static NSString? ErrorFontUrlsKey; -#endif - public static partial class Notifications { public static NSObject ObserveRegisteredFontsChanged (EventHandler handler) { @@ -583,27 +446,17 @@ public static NSObject ObserveRegisteredFontsChanged (EventHandler trampoline = &TrampolineRegistrationHandler; using var block = new BlockLiteral (trampoline, registrationHandler, typeof (CTFontManager), nameof (TrampolineRegistrationHandler)); -#else - using var block = new BlockLiteral (); - block.SetupBlockUnsafe (callback, registrationHandler); -#endif CTFontManagerRegisterFontDescriptors (arr.Handle, scope, enabled.AsByte (), &block); GC.KeepAlive (arr); } } } -#if NET [SupportedOSPlatform ("tvos13.0")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios13.0")] [SupportedOSPlatform ("maccatalyst")] -#else - [TV (13, 0)] - [iOS (13, 0)] -#endif [DllImport (Constants.CoreTextLibrary)] static extern unsafe void CTFontManagerUnregisterFontDescriptors (/* CFArrayRef */ IntPtr fontDescriptors, CTFontManagerScope scope, BlockLiteral* registrationHandler); -#if NET [SupportedOSPlatform ("tvos13.0")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios13.0")] [SupportedOSPlatform ("maccatalyst")] -#else - [TV (13, 0)] - [iOS (13, 0)] -#endif [BindingImpl (BindingImplOptions.Optimizable)] public unsafe static void UnregisterFontDescriptors (CTFontDescriptor [] fontDescriptors, CTFontManagerScope scope, CTFontRegistrationHandler registrationHandler) { @@ -654,13 +492,8 @@ public unsafe static void UnregisterFontDescriptors (CTFontDescriptor [] fontDes CTFontManagerUnregisterFontDescriptors (arr.Handle, scope, null); GC.KeepAlive (arr); } else { -#if NET delegate* unmanaged trampoline = &TrampolineRegistrationHandler; using var block = new BlockLiteral (trampoline, registrationHandler, typeof (CTFontManager), nameof (TrampolineRegistrationHandler)); -#else - using var block = new BlockLiteral (); - block.SetupBlockUnsafe (callback, registrationHandler); -#endif CTFontManagerUnregisterFontDescriptors (arr.Handle, scope, &block); GC.KeepAlive (arr); } @@ -668,27 +501,17 @@ public unsafe static void UnregisterFontDescriptors (CTFontDescriptor [] fontDes } #if __IOS__ -#if NET [SupportedOSPlatform ("ios13.0")] [SupportedOSPlatform ("maccatalyst")] - [SupportedOSPlatform ("macos")] - [SupportedOSPlatform ("tvos")] -#else - [iOS (13,0)] -#endif + [UnsupportedOSPlatform ("macos")] + [UnsupportedOSPlatform ("tvos")] [DllImport (Constants.CoreTextLibrary)] static extern /* CFArrayRef */ IntPtr CTFontManagerCopyRegisteredFontDescriptors (CTFontManagerScope scope, byte enabled); -#if NET [SupportedOSPlatform ("ios13.0")] [SupportedOSPlatform ("maccatalyst")] [UnsupportedOSPlatform ("tvos")] [UnsupportedOSPlatform ("macos")] -#else - [iOS (13,0)] - [NoTV] - [NoMac] -#endif public static CTFontDescriptor []? GetRegisteredFontDescriptors (CTFontManagerScope scope, bool enabled) { var p = CTFontManagerCopyRegisteredFontDescriptors (scope, enabled.AsByte ()); @@ -713,27 +536,17 @@ public unsafe static void UnregisterFontDescriptors (CTFontDescriptor [] fontDes return new CTFontDescriptor (p, owns: true); } -#if NET [SupportedOSPlatform ("tvos13.0")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios13.0")] [SupportedOSPlatform ("maccatalyst")] -#else - [TV (13, 0)] - [iOS (13, 0)] -#endif [DllImport (Constants.CoreTextLibrary)] static extern unsafe /* CFArrayRef */ IntPtr CTFontManagerCreateFontDescriptorsFromData (/* CFDataRef */ IntPtr data); -#if NET [SupportedOSPlatform ("tvos13.0")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios13.0")] [SupportedOSPlatform ("maccatalyst")] -#else - [TV (13, 0)] - [iOS (13, 0)] -#endif public static CTFontDescriptor []? CreateFontDescriptors (NSData data) { if (data is null) @@ -746,30 +559,18 @@ public unsafe static void UnregisterFontDescriptors (CTFontDescriptor [] fontDes } #if __IOS__ -#if NET [SupportedOSPlatform ("ios13.0")] [SupportedOSPlatform ("maccatalyst")] [UnsupportedOSPlatform ("tvos")] [UnsupportedOSPlatform ("macos")] -#else - [NoTV] - [NoMac] - [iOS (13,0)] -#endif [DllImport (Constants.CoreTextLibrary)] static extern unsafe void CTFontManagerRegisterFontsWithAssetNames (/* CFArrayRef */ IntPtr fontAssetNames, /* CFBundleRef _Nullable */ IntPtr bundle, CTFontManagerScope scope, byte enabled, BlockLiteral* registrationHandler); // reminder that NSBundle and CFBundle are NOT toll-free bridged :( -#if NET [SupportedOSPlatform ("ios13.0")] [SupportedOSPlatform ("maccatalyst")] [UnsupportedOSPlatform ("tvos")] [UnsupportedOSPlatform ("macos")] -#else - [NoTV] - [NoMac] - [iOS (13,0)] -#endif [BindingImpl (BindingImplOptions.Optimizable)] public unsafe static void RegisterFonts (string [] assetNames, CFBundle bundle, CTFontManagerScope scope, bool enabled, CTFontRegistrationHandler registrationHandler) { @@ -779,13 +580,8 @@ public unsafe static void RegisterFonts (string [] assetNames, CFBundle bundle, GC.KeepAlive (arr); GC.KeepAlive (bundle); } else { -#if NET delegate* unmanaged trampoline = &TrampolineRegistrationHandler; using var block = new BlockLiteral (trampoline, registrationHandler, typeof (CTFontManager), nameof (TrampolineRegistrationHandler)); -#else - using var block = new BlockLiteral (); - block.SetupBlockUnsafe (callback, registrationHandler); -#endif CTFontManagerRegisterFontsWithAssetNames (arr.Handle, bundle.GetHandle (), scope, enabled.AsByte (), &block); GC.KeepAlive (arr); GC.KeepAlive (bundle); @@ -793,41 +589,16 @@ public unsafe static void RegisterFonts (string [] assetNames, CFBundle bundle, } } -#if NET - // [SupportedOSPlatform ("ios13.0")] - Not valid on delegate declaration - // [SupportedOSPlatform ("maccatalyst")] - // [UnsupportedOSPlatform ("tvos")] - // [UnsupportedOSPlatform ("macos")] -#else - [NoTV] - [NoMac] - [iOS (13,0)] -#endif public delegate void CTFontManagerRequestFontsHandler (CTFontDescriptor [] unresolvedFontDescriptors); -#if NET [SupportedOSPlatform ("ios13.0")] [SupportedOSPlatform ("maccatalyst")] [UnsupportedOSPlatform ("tvos")] [UnsupportedOSPlatform ("macos")] -#else - [NoTV] - [NoMac] - [iOS (13,0)] -#endif [DllImport (Constants.CoreTextLibrary)] static extern unsafe void CTFontManagerRequestFonts (/* CFArrayRef */ IntPtr fontDescriptors, BlockLiteral* completionHandler); -#if !NET - internal delegate void InnerRequestFontsHandler (IntPtr block, IntPtr fontDescriptors); - static readonly InnerRequestFontsHandler requestCallback = TrampolineRequestFonts; -#endif - -#if NET [UnmanagedCallersOnly] -#else - [MonoPInvokeCallback (typeof (InnerRequestFontsHandler))] -#endif static unsafe void TrampolineRequestFonts (IntPtr block, /* CFArray */ IntPtr fontDescriptors) { var del = BlockLiteral.GetTarget (block); @@ -835,16 +606,10 @@ static unsafe void TrampolineRequestFonts (IntPtr block, /* CFArray */ IntPtr fo del (NSArray.ArrayFromHandle (fontDescriptors)); } -#if NET [SupportedOSPlatform ("ios13.0")] [SupportedOSPlatform ("maccatalyst")] [UnsupportedOSPlatform ("tvos")] [UnsupportedOSPlatform ("macos")] -#else - [NoTV] - [NoMac] - [iOS (13,0)] -#endif [BindingImpl (BindingImplOptions.Optimizable)] public static void RequestFonts (CTFontDescriptor [] fontDescriptors, CTFontManagerRequestFontsHandler completionHandler) { @@ -853,13 +618,8 @@ public static void RequestFonts (CTFontDescriptor [] fontDescriptors, CTFontMana using (var arr = EnsureNonNullArray (fontDescriptors, nameof (fontDescriptors))) { unsafe { -#if NET delegate* unmanaged trampoline = &TrampolineRequestFonts; using var block = new BlockLiteral (trampoline, completionHandler, typeof (CTFontManager), nameof (TrampolineRequestFonts)); -#else - using var block = new BlockLiteral (); - block.SetupBlockUnsafe (requestCallback, completionHandler); -#endif CTFontManagerRequestFonts (arr.Handle, &block); } } diff --git a/src/CoreText/CTFontNameKey.cs b/src/CoreText/CTFontNameKey.cs index b1653150ddaa..c438ec064a5c 100644 --- a/src/CoreText/CTFontNameKey.cs +++ b/src/CoreText/CTFontNameKey.cs @@ -78,50 +78,6 @@ public enum CTFontNameKey { } static partial class CTFontNameKeyId { -#if !NET - public static readonly NSString? Copyright; - public static readonly NSString? Family; - public static readonly NSString? SubFamily; - public static readonly NSString? Style; - public static readonly NSString? Unique; - public static readonly NSString? Full; - public static readonly NSString? Version; - public static readonly NSString? PostScript; - public static readonly NSString? Trademark; - public static readonly NSString? Manufacturer; - public static readonly NSString? Designer; - public static readonly NSString? Description; - public static readonly NSString? VendorUrl; - public static readonly NSString? DesignerUrl; - public static readonly NSString? License; - public static readonly NSString? LicenseUrl; - public static readonly NSString? SampleText; - public static readonly NSString? PostscriptCid; - - static CTFontNameKeyId () - { - var handle = Libraries.CoreText.Handle; - Copyright = Dlfcn.GetStringConstant (handle, "kCTFontCopyrightNameKey"); - Family = Dlfcn.GetStringConstant (handle, "kCTFontFamilyNameKey"); - SubFamily = Dlfcn.GetStringConstant (handle, "kCTFontSubFamilyNameKey"); - Style = Dlfcn.GetStringConstant (handle, "kCTFontStyleNameKey"); - Unique = Dlfcn.GetStringConstant (handle, "kCTFontUniqueNameKey"); - Full = Dlfcn.GetStringConstant (handle, "kCTFontFullNameKey"); - Version = Dlfcn.GetStringConstant (handle, "kCTFontVersionNameKey"); - PostScript = Dlfcn.GetStringConstant (handle, "kCTFontPostScriptNameKey"); - Trademark = Dlfcn.GetStringConstant (handle, "kCTFontTrademarkNameKey"); - Manufacturer = Dlfcn.GetStringConstant (handle, "kCTFontManufacturerNameKey"); - Designer = Dlfcn.GetStringConstant (handle, "kCTFontDesignerNameKey"); - Description = Dlfcn.GetStringConstant (handle, "kCTFontDescriptionNameKey"); - VendorUrl = Dlfcn.GetStringConstant (handle, "kCTFontVendorURLNameKey"); - DesignerUrl = Dlfcn.GetStringConstant (handle, "kCTFontDesignerURLNameKey"); - License = Dlfcn.GetStringConstant (handle, "kCTFontLicenseNameKey"); - LicenseUrl = Dlfcn.GetStringConstant (handle, "kCTFontLicenseURLNameKey"); - SampleText = Dlfcn.GetStringConstant (handle, "kCTFontSampleTextNameKey"); - PostscriptCid = Dlfcn.GetStringConstant (handle, "kCTFontPostScriptCIDNameKey"); - } -#endif - public static NSString? ToId (CTFontNameKey key) { switch (key) { diff --git a/src/CoreText/CTFontTrait.cs b/src/CoreText/CTFontTrait.cs index eb0faf04d3e3..478f28b40fd5 100644 --- a/src/CoreText/CTFontTrait.cs +++ b/src/CoreText/CTFontTrait.cs @@ -38,25 +38,6 @@ using System.Runtime.Versioning; namespace CoreText { - -#if !NET - public static class CTFontTraitKey { - public static readonly NSString? Symbolic; - public static readonly NSString? Weight; - public static readonly NSString? Width; - public static readonly NSString? Slant; - - static CTFontTraitKey () - { - var handle = Libraries.CoreText.Handle; - Symbolic = Dlfcn.GetStringConstant (handle, "kCTFontSymbolicTrait"); - Weight = Dlfcn.GetStringConstant (handle, "kCTFontWeightTrait"); - Width = Dlfcn.GetStringConstant (handle, "kCTFontWidthTrait"); - Slant = Dlfcn.GetStringConstant (handle, "kCTFontSlantTrait"); - } - } -#endif - [Flags] // defined as uint32_t - /System/Library/Frameworks/CoreText.framework/Headers/CTFontTraits.h public enum CTFontSymbolicTraits : uint { @@ -118,12 +99,10 @@ public enum CTFontStylisticClass : uint { Symbolic = ((uint) 12 << CTFontTraits.ClassMaskShift), } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFontTraits { public CTFontTraits () diff --git a/src/CoreText/CTFrame.cs b/src/CoreText/CTFrame.cs index 2b3b93cab372..2dcd79fa4fa9 100644 --- a/src/CoreText/CTFrame.cs +++ b/src/CoreText/CTFrame.cs @@ -37,10 +37,6 @@ using CoreFoundation; using CoreGraphics; -#if !NET -using NativeHandle = System.IntPtr; -#endif - namespace CoreText { [Flags] @@ -59,34 +55,10 @@ public enum CTFramePathFillRule { WindingNumber, } -#if !NET - public static class CTFrameAttributeKey { - - public static readonly NSString? Progression; - - public static readonly NSString? PathFillRule; - public static readonly NSString? PathWidth; - public static readonly NSString? ClippingPaths; - public static readonly NSString? PathClippingPath; - - static CTFrameAttributeKey () - { - var handle = Libraries.CoreText.Handle; - Progression = Dlfcn.GetStringConstant (handle, "kCTFrameProgressionAttributeName"); - PathFillRule = Dlfcn.GetStringConstant (handle, "kCTFramePathFillRuleAttributeName"); - PathWidth = Dlfcn.GetStringConstant (handle, "kCTFramePathWidthAttributeName"); - ClippingPaths = Dlfcn.GetStringConstant (handle, "kCTFrameClippingPathsAttributeName"); - PathClippingPath = Dlfcn.GetStringConstant (handle, "kCTFramePathClippingPathAttributeName"); - } - } -#endif - -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFrameAttributes { public CTFrameAttributes () @@ -130,12 +102,10 @@ public static IntPtr GetHandle (this CTFrameAttributes? self) } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFrame : NativeObject { [Preserve (Conditional = true)] internal CTFrame (NativeHandle handle, bool owns) diff --git a/src/CoreText/CTFramesetter.cs b/src/CoreText/CTFramesetter.cs index 0a15557c3470..4fbad55b5203 100644 --- a/src/CoreText/CTFramesetter.cs +++ b/src/CoreText/CTFramesetter.cs @@ -36,18 +36,11 @@ using CoreFoundation; using CoreGraphics; -#if !NET -using NativeHandle = System.IntPtr; -#endif - namespace CoreText { - -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTFramesetter : NativeObject { [Preserve (Conditional = true)] internal CTFramesetter (NativeHandle handle, bool owns) @@ -107,21 +100,17 @@ public CGSize SuggestFrameSize (NSRange stringRange, CTFrameAttributes? frameAtt } } #endregion -#if NET [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("tvos")] [SupportedOSPlatform ("maccatalyst")] -#endif [DllImport (Constants.CoreTextLibrary)] static extern IntPtr CTFramesetterCreateWithTypesetter (IntPtr typesetter); -#if NET [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("tvos")] [SupportedOSPlatform ("maccatalyst")] -#endif public static CTFramesetter? Create (CTTypesetter typesetter) { if (typesetter is null) diff --git a/src/CoreText/CTGlyphInfo.cs b/src/CoreText/CTGlyphInfo.cs index 5b660f96debf..eed76716b7ad 100644 --- a/src/CoreText/CTGlyphInfo.cs +++ b/src/CoreText/CTGlyphInfo.cs @@ -37,10 +37,6 @@ using CGGlyph = System.UInt16; using CGFontIndex = System.UInt16; -#if !NET -using NativeHandle = System.IntPtr; -#endif - namespace CoreText { #region Glyph Info Values @@ -60,12 +56,10 @@ public enum CTCharacterCollection : ushort { } #endregion -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTGlyphInfo : NativeObject { [Preserve (Conditional = true)] internal CTGlyphInfo (NativeHandle handle, bool owns) @@ -181,27 +175,17 @@ public CTCharacterCollection CharacterCollection { get { return CTGlyphInfoGetCharacterCollection (Handle); } } -#if NET [SupportedOSPlatform ("ios13.0")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos13.0")] [SupportedOSPlatform ("maccatalyst")] -#else - [iOS (13, 0)] - [TV (13, 0)] -#endif [DllImport (Constants.CoreTextLibrary)] static extern ushort /* CGGlyph */ CTGlyphInfoGetGlyph (IntPtr /* CTGlyphInfoRef */ glyphInfo); -#if NET [SupportedOSPlatform ("ios13.0")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos13.0")] [SupportedOSPlatform ("maccatalyst")] -#else - [iOS (13, 0)] - [TV (13, 0)] -#endif public CGGlyph GetGlyph () { return CTGlyphInfoGetGlyph (Handle); diff --git a/src/CoreText/CTLine.cs b/src/CoreText/CTLine.cs index e62d03f8a836..3b4003de0d2f 100644 --- a/src/CoreText/CTLine.cs +++ b/src/CoreText/CTLine.cs @@ -37,10 +37,6 @@ using CoreFoundation; using CoreGraphics; -#if !NET -using NativeHandle = System.IntPtr; -#endif - namespace CoreText { // defined as uint32_t - /System/Library/Frameworks/CoreText.framework/Headers/CTLine.h @@ -85,12 +81,10 @@ public enum CTLineBoundsOptions : ulong { IncludeLanguageExtents = 1 << 5, // iOS8 and Mac 10.11 } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTLine : NativeObject { [Preserve (Conditional = true)] internal CTLine (NativeHandle handle, bool owns) @@ -245,26 +239,15 @@ public nfloat GetOffsetForStringIndex (nint charIndex) } public delegate void CaretEdgeEnumerator (double offset, nint charIndex, bool leadingEdge, ref bool stop); -#if !NET - unsafe delegate void CaretEdgeEnumeratorProxy (IntPtr block, double offset, nint charIndex, byte leadingEdge, byte* stop); -#endif -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("tvos")] -#endif [DllImport (Constants.CoreTextLibrary)] unsafe static extern void CTLineEnumerateCaretOffsets (IntPtr line, BlockLiteral* blockEnumerator); -#if !NET - static unsafe readonly CaretEdgeEnumeratorProxy static_enumerate = TrampolineEnumerate; - - [MonoPInvokeCallback (typeof (CaretEdgeEnumeratorProxy))] -#else [UnmanagedCallersOnly] -#endif unsafe static void TrampolineEnumerate (IntPtr blockPtr, double offset, nint charIndex, byte leadingEdge, byte* stopPointer) { var del = BlockLiteral.GetTarget (blockPtr); @@ -275,12 +258,10 @@ unsafe static void TrampolineEnumerate (IntPtr blockPtr, double offset, nint cha } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("tvos")] -#endif [BindingImpl (BindingImplOptions.Optimizable)] public void EnumerateCaretOffsets (CaretEdgeEnumerator enumerator) { @@ -288,13 +269,8 @@ public void EnumerateCaretOffsets (CaretEdgeEnumerator enumerator) ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (enumerator)); unsafe { -#if NET delegate* unmanaged trampoline = &TrampolineEnumerate; using var block = new BlockLiteral (trampoline, enumerator, typeof (CTLine), nameof (TrampolineEnumerate)); -#else - using var block = new BlockLiteral (); - block.SetupBlockUnsafe (static_enumerate, enumerator); -#endif CTLineEnumerateCaretOffsets (Handle, &block); } } diff --git a/src/CoreText/CTParagraphStyle.cs b/src/CoreText/CTParagraphStyle.cs index 560fddc81a04..170733f850a9 100644 --- a/src/CoreText/CTParagraphStyle.cs +++ b/src/CoreText/CTParagraphStyle.cs @@ -37,10 +37,6 @@ using Foundation; using CoreFoundation; -#if !NET -using NativeHandle = System.IntPtr; -#endif - namespace CoreText { #region Paragraph Style Values @@ -104,7 +100,6 @@ internal enum CTParagraphStyleSpecifier : uint { LineHeightMultiple = 7, MaximumLineHeight = 8, MinimumLineHeight = 9, -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] @@ -113,11 +108,6 @@ internal enum CTParagraphStyleSpecifier : uint { [ObsoletedOSPlatform ("ios6.0", "Use 'MaximumLineSpacing' instead.")] [ObsoletedOSPlatform ("tvos16.0", "Use 'MaximumLineSpacing' instead.")] [ObsoletedOSPlatform ("maccatalyst13.1", "Use 'MaximumLineSpacing' instead.")] -#else - [Deprecated (PlatformName.iOS, 6, 0, message: "Use 'MaximumLineSpacing' instead.")] - [Deprecated (PlatformName.MacOSX, 10, 8, message: "Use 'MaximumLineSpacing' instead.")] - [Deprecated (PlatformName.TvOS, 16, 0, message: "Use 'MaximumLineSpacing' instead.")] -#endif LineSpacing = 10, ParagraphSpacing = 11, ParagraphSpacingBefore = 12, @@ -244,12 +234,10 @@ public override void Dispose (CTParagraphStyleSettingValue [] values, int index) } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTParagraphStyleSettings { public CTParagraphStyleSettings () @@ -357,8 +345,10 @@ internal List GetSpecifiers () values.Add (CreateValue (CTParagraphStyleSpecifier.MaximumLineHeight, MaximumLineHeight.Value)); if (MinimumLineHeight.HasValue) values.Add (CreateValue (CTParagraphStyleSpecifier.MinimumLineHeight, MinimumLineHeight.Value)); +#pragma warning disable CA1422 // This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'CTParagraphStyleSpecifier.LineSpacing' is obsoleted on: 'ios' 6.0 and later (Use 'MaximumLineSpacing' instead.), 'maccatalyst' 6.0 and later (Use 'MaximumLineSpacing' instead.), 'macOS/OSX' 10.8 and later (Use 'MaximumLineSpacing' instead.), 'tvos' 16.0 and later (Use 'MaximumLineSpacing' instead.). if (LineSpacing.HasValue) values.Add (CreateValue (CTParagraphStyleSpecifier.LineSpacing, LineSpacing.Value)); +#pragma warning restore CA1422 if (ParagraphSpacing.HasValue) values.Add (CreateValue (CTParagraphStyleSpecifier.ParagraphSpacing, ParagraphSpacing.Value)); if (ParagraphSpacingBefore.HasValue) @@ -402,12 +392,10 @@ static CTParagraphStyleSpecifierValue CreateValue (CTParagraphStyleSpecifier spe } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTParagraphStyle : NativeObject { [Preserve (Conditional = true)] internal CTParagraphStyle (NativeHandle handle, bool owns) @@ -515,129 +503,89 @@ public CTWritingDirection BaseWritingDirection { get { return (CTWritingDirection) GetByteValue (CTParagraphStyleSpecifier.BaseWritingDirection); } } -#if NET /// To be added. /// To be added. /// To be added. public nfloat FirstLineHeadIndent { -#else - public float FirstLineHeadIndent { -#endif get { return GetFloatValue (CTParagraphStyleSpecifier.FirstLineHeadIndent); } } -#if NET unsafe nfloat GetFloatValue (CTParagraphStyleSpecifier spec) -#else - unsafe float GetFloatValue (CTParagraphStyleSpecifier spec) -#endif { nfloat value; if (CTParagraphStyleGetValueForSpecifier (Handle, spec, (nuint) sizeof (nfloat), &value) == 0) throw new InvalidOperationException ("Unable to get property value."); -#if NET return value; -#else - return (float) value; -#endif } -#if NET /// To be added. /// To be added. /// To be added. public nfloat HeadIndent { -#else - public float HeadIndent { -#endif get { return GetFloatValue (CTParagraphStyleSpecifier.HeadIndent); } } -#if NET /// To be added. /// To be added. /// To be added. public nfloat TailIndent { -#else - public float TailIndent { -#endif get { return GetFloatValue (CTParagraphStyleSpecifier.TailIndent); } } -#if NET /// To be added. /// To be added. /// To be added. public nfloat DefaultTabInterval { -#else - public float DefaultTabInterval { -#endif get { return GetFloatValue (CTParagraphStyleSpecifier.DefaultTabInterval); } } -#if NET /// To be added. /// To be added. /// To be added. public nfloat LineHeightMultiple { -#else - public float LineHeightMultiple { -#endif get { return GetFloatValue (CTParagraphStyleSpecifier.LineHeightMultiple); } } -#if NET /// To be added. /// To be added. /// To be added. public nfloat MaximumLineHeight { -#else - public float MaximumLineHeight { -#endif get { return GetFloatValue (CTParagraphStyleSpecifier.MaximumLineHeight); } } -#if NET /// To be added. /// To be added. /// To be added. public nfloat MinimumLineHeight { -#else - public float MinimumLineHeight { -#endif get { return GetFloatValue (CTParagraphStyleSpecifier.MinimumLineHeight); } } -#if NET /// To be added. /// To be added. /// To be added. + [SupportedOSPlatform ("ios")] + [SupportedOSPlatform ("maccatalyst")] + [SupportedOSPlatform ("macos")] + [SupportedOSPlatform ("tvos")] + [ObsoletedOSPlatform ("macos10.8", "Use 'MaximumLineSpacing' instead.")] + [ObsoletedOSPlatform ("ios6.0", "Use 'MaximumLineSpacing' instead.")] + [ObsoletedOSPlatform ("tvos16.0", "Use 'MaximumLineSpacing' instead.")] + [ObsoletedOSPlatform ("maccatalyst13.1", "Use 'MaximumLineSpacing' instead.")] public nfloat LineSpacing { -#else - public float LineSpacing { -#endif get { return GetFloatValue (CTParagraphStyleSpecifier.LineSpacing); } } -#if NET /// To be added. /// To be added. /// To be added. public nfloat ParagraphSpacing { -#else - public float ParagraphSpacing { -#endif get { return GetFloatValue (CTParagraphStyleSpecifier.ParagraphSpacing); } } -#if NET /// To be added. /// To be added. /// To be added. public nfloat ParagraphSpacingBefore { -#else - public float ParagraphSpacingBefore { -#endif get { return GetFloatValue (CTParagraphStyleSpecifier.ParagraphSpacingBefore); } } #endregion diff --git a/src/CoreText/CTRun.cs b/src/CoreText/CTRun.cs index b40754602471..fbc66925d9b6 100644 --- a/src/CoreText/CTRun.cs +++ b/src/CoreText/CTRun.cs @@ -37,10 +37,6 @@ using CoreFoundation; using CoreGraphics; -#if !NET -using NativeHandle = System.IntPtr; -#endif - namespace CoreText { // defined as uint32_t - System/Library/Frameworks/CoreText.framework/Headers/CTRun.h @@ -55,12 +51,10 @@ public enum CTRunStatus { HasNonIdentityMatrix = (1 << 2), } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTRun : NativeObject { [Preserve (Conditional = true)] internal CTRun (NativeHandle handle, bool owns) @@ -251,27 +245,17 @@ public double GetTypographicBounds () return CTRunGetTypographicBounds (Handle, range, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero); } -#if NET [SupportedOSPlatform ("tvos13.0")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios13.0")] [SupportedOSPlatform ("maccatalyst")] -#else - [TV (13, 0)] - [iOS (13, 0)] -#endif [DllImport (Constants.CoreTextLibrary)] static extern void CTRunGetBaseAdvancesAndOrigins (/* CTRunRef */ IntPtr runRef, /* CFRange */ NSRange range, CGSize [] advancesBuffer, CGPoint [] originsBuffer); -#if NET [SupportedOSPlatform ("tvos13.0")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios13.0")] [SupportedOSPlatform ("maccatalyst")] -#else - [TV (13, 0)] - [iOS (13, 0)] -#endif public void GetBaseAdvancesAndOrigins (NSRange range, out CGSize [] advancesBuffer, out CGPoint [] originsBuffer) { advancesBuffer = GetBuffer (range, null); diff --git a/src/CoreText/CTRunDelegate.cs b/src/CoreText/CTRunDelegate.cs index 47d3b111972e..f4d456ff7860 100644 --- a/src/CoreText/CTRunDelegate.cs +++ b/src/CoreText/CTRunDelegate.cs @@ -36,17 +36,12 @@ using CoreFoundation; using CoreGraphics; -#if !NET -using NativeHandle = System.IntPtr; -#endif - namespace CoreText { #region Run Delegate Callbacks delegate void CTRunDelegateDeallocateCallback (IntPtr refCon); delegate nfloat CTRunDelegateGetCallback (IntPtr refCon); -#if NET [StructLayout (LayoutKind.Sequential)] struct CTRunDelegateCallbacks { public /* CFIndex */ nint version; @@ -55,24 +50,12 @@ struct CTRunDelegateCallbacks { public unsafe delegate* unmanaged getDescent; public unsafe delegate* unmanaged getWidth; } -#else - [StructLayout (LayoutKind.Sequential)] - struct CTRunDelegateCallbacks { - public /* CFIndex */ nint version; - public IntPtr dealloc; - public IntPtr getAscent; - public IntPtr getDescent; - public IntPtr getWidth; - } -#endif #endregion -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTRunDelegateOperations : IDisposable { // This instance is kept alive using a GCHandle until the Deallocate callback has been called, // which is called when the corresponding CTRunDelegate is freed (retainCount reaches 0). @@ -103,7 +86,6 @@ protected virtual void Dispose (bool disposing) { } -#if NET public virtual nfloat GetAscent () { return 0; @@ -118,28 +100,11 @@ public virtual nfloat GetWidth () { return 0; } -#else - public virtual float GetAscent () - { - return 0.0f; - } - - public virtual float GetDescent () - { - return 0.0f; - } - - public virtual float GetWidth () - { - return 0.0f; - } -#endif CTRunDelegateCallbacks? callbacks; // prevent GC since they are called from native code internal CTRunDelegateCallbacks GetCallbacks () { if (!callbacks.HasValue) { -#if NET unsafe { callbacks = new CTRunDelegateCallbacks () { version = 1, @@ -149,25 +114,11 @@ internal CTRunDelegateCallbacks GetCallbacks () getWidth = &GetWidth, }; } -#else - callbacks = new CTRunDelegateCallbacks () { - version = 1, // kCTRunDelegateVersion1 - dealloc = Marshal.GetFunctionPointerForDelegate (DeallocateDelegate), - getAscent = Marshal.GetFunctionPointerForDelegate (GetAscentDelegate), - getDescent = Marshal.GetFunctionPointerForDelegate (GetDescentDelegate), - getWidth = Marshal.GetFunctionPointerForDelegate (GetWidthDelegate), - }; -#endif } return callbacks.Value; } -#if NET [UnmanagedCallersOnly] -#else - static CTRunDelegateDeallocateCallback DeallocateDelegate = Deallocate; - [MonoPInvokeCallback (typeof (CTRunDelegateDeallocateCallback))] -#endif static void Deallocate (IntPtr refCon) { var self = GetOperations (refCon); @@ -188,12 +139,7 @@ static void Deallocate (IntPtr refCon) return c.Target as CTRunDelegateOperations; } -#if NET [UnmanagedCallersOnly] -#else - static CTRunDelegateGetCallback GetAscentDelegate = GetAscent; - [MonoPInvokeCallback (typeof (CTRunDelegateGetCallback))] -#endif static nfloat GetAscent (IntPtr refCon) { var self = GetOperations (refCon); @@ -202,12 +148,7 @@ static nfloat GetAscent (IntPtr refCon) return (nfloat) self.GetAscent (); } -#if NET [UnmanagedCallersOnly] -#else - static CTRunDelegateGetCallback GetDescentDelegate = GetDescent; - [MonoPInvokeCallback (typeof (CTRunDelegateGetCallback))] -#endif static nfloat GetDescent (IntPtr refCon) { var self = GetOperations (refCon); @@ -216,12 +157,7 @@ static nfloat GetDescent (IntPtr refCon) return (nfloat) self.GetDescent (); } -#if NET [UnmanagedCallersOnly] -#else - static CTRunDelegateGetCallback GetWidthDelegate = GetWidth; - [MonoPInvokeCallback (typeof (CTRunDelegateGetCallback))] -#endif static nfloat GetWidth (IntPtr refCon) { var self = GetOperations (refCon); @@ -231,12 +167,10 @@ static nfloat GetWidth (IntPtr refCon) } } -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTRunDelegate : NativeObject, IDisposable { [Preserve (Conditional = true)] internal CTRunDelegate (NativeHandle handle, bool owns) diff --git a/src/CoreText/CTStringAttributes.cs b/src/CoreText/CTStringAttributes.cs index ebb4fe2b3d34..8b690198025b 100644 --- a/src/CoreText/CTStringAttributes.cs +++ b/src/CoreText/CTStringAttributes.cs @@ -43,10 +43,6 @@ using UIKit; #endif -#if !NET -using NativeHandle = System.IntPtr; -#endif - namespace CoreText { #region CFAttributedStringRef AttributeKey Prototypes @@ -93,69 +89,12 @@ public enum CTSuperscriptStyle { /// To be added. Subscript = -1, } - -#if !NET - public static partial class CTStringAttributeKey { - public static readonly NSString? Font; - public static readonly NSString? ForegroundColorFromContext; - public static readonly NSString? KerningAdjustment; - public static readonly NSString? LigatureFormation; - public static readonly NSString? ForegroundColor; - public static readonly NSString? BackgroundColor; - public static readonly NSString? ParagraphStyle; - public static readonly NSString? StrokeWidth; - public static readonly NSString? StrokeColor; - public static readonly NSString? UnderlineStyle; - public static readonly NSString? Superscript; - public static readonly NSString? UnderlineColor; - public static readonly NSString? VerticalForms; - public static readonly NSString? HorizontalInVerticalForms; - public static readonly NSString? GlyphInfo; - public static readonly NSString? CharacterShape; - public static readonly NSString? RunDelegate; - // Since 6,0 - internal static readonly NSString? BaselineClass; - internal static readonly NSString? BaselineInfo; - internal static readonly NSString? BaselineReferenceInfo; - internal static readonly NSString? BaselineOffset; - internal static readonly NSString? WritingDirection; - - static CTStringAttributeKey () - { - var handle = Libraries.CoreText.Handle; - Font = Dlfcn.GetStringConstant (handle, "kCTFontAttributeName"); - ForegroundColorFromContext = Dlfcn.GetStringConstant (handle, "kCTForegroundColorFromContextAttributeName"); - KerningAdjustment = Dlfcn.GetStringConstant (handle, "kCTKernAttributeName"); - LigatureFormation = Dlfcn.GetStringConstant (handle, "kCTLigatureAttributeName"); - ForegroundColor = Dlfcn.GetStringConstant (handle, "kCTForegroundColorAttributeName"); - BackgroundColor = Dlfcn.GetStringConstant (handle, "kCTBackgroundColorAttributeName"); - ParagraphStyle = Dlfcn.GetStringConstant (handle, "kCTParagraphStyleAttributeName"); - StrokeWidth = Dlfcn.GetStringConstant (handle, "kCTStrokeWidthAttributeName"); - StrokeColor = Dlfcn.GetStringConstant (handle, "kCTStrokeColorAttributeName"); - UnderlineStyle = Dlfcn.GetStringConstant (handle, "kCTUnderlineStyleAttributeName"); - Superscript = Dlfcn.GetStringConstant (handle, "kCTSuperscriptAttributeName"); - UnderlineColor = Dlfcn.GetStringConstant (handle, "kCTUnderlineColorAttributeName"); - VerticalForms = Dlfcn.GetStringConstant (handle, "kCTVerticalFormsAttributeName"); - HorizontalInVerticalForms = Dlfcn.GetStringConstant (handle, "kCTHorizontalInVerticalFormsAttributeName"); - GlyphInfo = Dlfcn.GetStringConstant (handle, "kCTGlyphInfoAttributeName"); - CharacterShape = Dlfcn.GetStringConstant (handle, "kCTCharacterShapeAttributeName"); - RunDelegate = Dlfcn.GetStringConstant (handle, "kCTRunDelegateAttributeName"); - BaselineOffset = Dlfcn.GetStringConstant (handle, "kCTBaselineOffsetAttributeName"); - BaselineClass = Dlfcn.GetStringConstant (handle, "kCTBaselineClassAttributeName"); - BaselineInfo = Dlfcn.GetStringConstant (handle, "kCTBaselineInfoAttributeName"); - BaselineReferenceInfo = Dlfcn.GetStringConstant (handle, "kCTBaselineReferenceInfoAttributeName"); - WritingDirection = Dlfcn.GetStringConstant (handle, "kCTWritingDirectionAttributeName"); - } - } -#endif // !NET #endregion -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTStringAttributes { public CTStringAttributes () @@ -236,7 +175,6 @@ public CGColor? ForegroundColor { set { Adapter.SetNativeValue (Dictionary, CTStringAttributeKey.ForegroundColor!, value); } } -#if NET /// To be added. /// To be added. /// To be added. @@ -244,7 +182,6 @@ public CGColor? ForegroundColor { [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("tvos")] -#endif public CGColor? BackgroundColor { get { var x = CTStringAttributeKey.BackgroundColor; @@ -295,15 +232,10 @@ public CGColor? StrokeColor { set { Adapter.SetNativeValue (Dictionary, CTStringAttributeKey.StrokeColor!, value); } } -#if NET [SupportedOSPlatform ("tvos13.0")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios13.0")] [SupportedOSPlatform ("maccatalyst")] -#else - [TV (13, 0)] - [iOS (13, 0)] -#endif public float? TrackingAdjustment { get { return Adapter.GetSingleValue (Dictionary, CTStringAttributeKey.TrackingAttributeName); } set { Adapter.SetValue (Dictionary, CTStringAttributeKey.TrackingAttributeName, value); } @@ -393,7 +325,6 @@ public bool VerticalForms { } } -#if NET /// To be added. /// To be added. /// To be added. @@ -401,7 +332,6 @@ public bool VerticalForms { [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] [SupportedOSPlatform ("maccatalyst")] -#endif public int? HorizontalInVerticalForms { get { var x = CTStringAttributeKey.HorizontalInVerticalForms; @@ -414,7 +344,6 @@ public int? HorizontalInVerticalForms { } } -#if NET /// To be added. /// To be added. /// To be added. @@ -422,7 +351,6 @@ public int? HorizontalInVerticalForms { [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] [SupportedOSPlatform ("maccatalyst")] -#endif public float? BaselineOffset { get { return Adapter.GetSingleValue (Dictionary, CTStringAttributeKey.BaselineOffset); } set { Adapter.SetValue (Dictionary, CTStringAttributeKey.BaselineOffset!, value); } @@ -509,7 +437,6 @@ public void SetWritingDirection (params CTWritingDirection [] writingDirections) GC.KeepAlive (numbers); // make sure the numbers aren't freed until we're done with them } -#if NET [SupportedOSPlatform ("ios18.0")] [SupportedOSPlatform ("maccatalyst18.0")] [SupportedOSPlatform ("macos15.0")] @@ -524,6 +451,5 @@ public ICTAdaptiveImageProviding? AdaptiveImageProvider { Adapter.SetNativeValue (Dictionary, CTStringAttributeKey.AdaptiveImageProvider!, value); } } -#endif } } diff --git a/src/CoreText/CTTextTab.cs b/src/CoreText/CTTextTab.cs index a98f7d652329..a03e2d672b5d 100644 --- a/src/CoreText/CTTextTab.cs +++ b/src/CoreText/CTTextTab.cs @@ -35,31 +35,12 @@ using Foundation; using CoreFoundation; -#if !NET -using NativeHandle = System.IntPtr; -#endif - namespace CoreText { - #region Text Tab Constants -#if !NET - public static class CTTextTabOptionKey { - - public static readonly NSString ColumnTerminators; - - static CTTextTabOptionKey () - { - ColumnTerminators = Dlfcn.GetStringConstant (Libraries.CoreText.Handle, "kCTTabColumnTerminatorsAttributeName")!; - } - } -#endif - -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTTextTabOptions { public CTTextTabOptions () @@ -96,14 +77,11 @@ public static IntPtr GetHandle (this CTTextTabOptions? self) return self.Dictionary.GetHandle (); } } - #endregion -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTTextTab : NativeObject { [Preserve (Conditional = true)] internal CTTextTab (NativeHandle handle, bool owns) diff --git a/src/CoreText/CTTypesetter.cs b/src/CoreText/CTTypesetter.cs index b7fd28d29996..96aebce75fad 100644 --- a/src/CoreText/CTTypesetter.cs +++ b/src/CoreText/CTTypesetter.cs @@ -37,20 +37,14 @@ using CoreFoundation; using CoreGraphics; -#if !NET -using NativeHandle = System.IntPtr; -#endif - namespace CoreText { #region Typesetter Values -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTTypesetterOptions { public CTTypesetterOptions () @@ -70,7 +64,6 @@ public CTTypesetterOptions (NSDictionary dictionary) /// To be added. public NSDictionary Dictionary { get; private set; } -#if NET /// Developers should not use this deprecated property. /// To be added. /// To be added. @@ -79,9 +72,9 @@ public CTTypesetterOptions (NSDictionary dictionary) [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] [ObsoletedOSPlatform ("ios6.0")] -#else - [Deprecated (PlatformName.iOS, 6, 0)] -#endif + [ObsoletedOSPlatform ("tvos")] + [ObsoletedOSPlatform ("macos")] + [ObsoletedOSPlatform ("maccatalyst")] public bool DisableBidiProcessing { get { return CFDictionary.GetBooleanValue (Dictionary.Handle, @@ -103,7 +96,6 @@ public int? ForceEmbeddingLevel { set { Adapter.SetValue (Dictionary, CTTypesetterOptionKey.ForceEmbeddingLevel, value); } } -#if NET /// To be added. /// To be added. /// To be added. @@ -111,7 +103,6 @@ public int? ForceEmbeddingLevel { [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] -#endif public bool AllowUnboundedLayout { get => CFDictionary.GetBooleanValue (Dictionary.Handle, CTTypesetterOptionKey.AllowUnboundedLayout.Handle); set { @@ -131,12 +122,10 @@ public static IntPtr GetHandle (this CTTypesetterOptions? self) } #endregion -#if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] -#endif public class CTTypesetter : NativeObject { [Preserve (Conditional = true)] internal CTTypesetter (NativeHandle handle, bool owns) diff --git a/src/CoreText/CTTypesetterOptionKeyCompat.cs b/src/CoreText/CTTypesetterOptionKeyCompat.cs deleted file mode 100644 index 0e711cdf308e..000000000000 --- a/src/CoreText/CTTypesetterOptionKeyCompat.cs +++ /dev/null @@ -1,28 +0,0 @@ -// -// CTTypesetterOptionKeyCompat.cs -// -// Authors: -// Alex Soto -// -// Copyright 2018 Microsoft Corporation. -// - -#nullable enable - -#if !NET -using System; -using ObjCRuntime; -using Foundation; - -namespace CoreText { - public static partial class CTTypesetterOptionKey { -#if NET - [ObsoletedOSPlatform ("ios6.0")] -#else - [Deprecated (PlatformName.iOS, 6, 0)] -#endif - public static readonly NSString DisableBidiProcessing = _DisableBidiProcessing; - public static readonly NSString ForceEmbeddingLevel = _ForceEmbeddingLevel; - } -} -#endif diff --git a/src/coretext.cs b/src/coretext.cs index f8807bfd0ed3..dd2e42022c1a 100644 --- a/src/coretext.cs +++ b/src/coretext.cs @@ -129,21 +129,13 @@ interface CTTypesetterOptionKey { [Deprecated (PlatformName.iOS, 6, 0)] [Deprecated (PlatformName.MacCatalyst, 13, 1)] + [Deprecated (PlatformName.MacOSX, 10, 8)] + [Deprecated (PlatformName.TvOS, 9, 0)] [Field ("kCTTypesetterOptionDisableBidiProcessing")] -#if !NET - [Internal] - NSString _DisableBidiProcessing { get; } -#else NSString DisableBidiProcessing { get; } -#endif [Field ("kCTTypesetterOptionForcedEmbeddingLevel")] -#if !NET - [Internal] - NSString _ForceEmbeddingLevel { get; } -#else NSString ForceEmbeddingLevel { get; } -#endif /// To be added. /// To be added. @@ -169,7 +161,6 @@ interface CTFontManagerErrorKeys { NSString FontAssetNameKey { get; } } -#if NET [Internal] [Static] [Partial] @@ -385,7 +376,6 @@ interface CTFontCollectionOptionKey { [Field ("kCTFontCollectionRemoveDuplicatesOption")] NSString RemoveDuplicates { get; } } -#endif [Internal] [Static] @@ -431,7 +421,6 @@ interface CTFontDescriptorMatchingProgress { [Static] [Partial] interface CTStringAttributeKey { -#if NET [Field ("kCTFontAttributeName")] NSString Font { get; } @@ -504,7 +493,6 @@ interface CTStringAttributeKey { [TV (18, 0), Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)] [Field ("kCTAdaptiveImageProviderAttributeName")] NSString AdaptiveImageProvider { get; } -#endif [TV (13, 0), iOS (13, 0)] [MacCatalyst (13, 1)] diff --git a/src/frameworks.sources b/src/frameworks.sources index d9c16e2df85c..2d6e39a45b26 100644 --- a/src/frameworks.sources +++ b/src/frameworks.sources @@ -685,7 +685,6 @@ CORETEXT_SOURCES = \ CoreText/CTStringAttributes.cs \ CoreText/CTTextTab.cs \ CoreText/CTTypesetter.cs \ - CoreText/CTTypesetterOptionKeyCompat.cs \ CoreText/ConstructorError.cs \ # CoreTelephony diff --git a/tests/cecil-tests/ApiAvailabilityTest.KnownFailures.cs b/tests/cecil-tests/ApiAvailabilityTest.KnownFailures.cs index 9235797989cd..50346429d1ff 100644 --- a/tests/cecil-tests/ApiAvailabilityTest.KnownFailures.cs +++ b/tests/cecil-tests/ApiAvailabilityTest.KnownFailures.cs @@ -17,9 +17,6 @@ namespace Cecil.Tests { public partial class ApiAvailabilityTest { static HashSet knownFailuresAvailabilityWarnings = new HashSet { - "/src/CoreText/CTFont.cs has 4 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'CTFontFeatureLetterCase' is obsoleted on: 'ios' 6.0 and later, 'maccatalyst' 6.0 and later, 'macOS/OSX' 10.7 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)", - "/src/CoreText/CTFont.cs has 4 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'FontFeatureGroup.LetterCase' is obsoleted on: 'ios' 6.0 and later, 'maccatalyst' 6.0 and later, 'macOS/OSX' 10.7 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)", - "/src/CoreText/CTParagraphStyle.cs has 8 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'CTParagraphStyleSpecifier.LineSpacing' is obsoleted on: 'ios' 6.0 and later (Use 'MaximumLineSpacing' instead.), 'maccatalyst' 6.0 and later (Use 'MaximumLineSpacing' instead.), 'macOS/OSX' 10.8 and later (Use 'MaximumLineSpacing' instead.), 'tvos' 16.0 and later (Use 'MaximumLineSpacing' instead.). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)", "/src/CoreVideo/CVBuffer.cs has 4 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'CVBuffer.CVBufferCopyAttachment(nint, nint, CVAttachmentMode*)' is supported on: 'ios' 15.0 and later, 'tvos' 15.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)", "/src/CoreVideo/CVBuffer.cs has 4 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'CVBuffer.CVBufferCopyAttachments(nint, CVAttachmentMode)' is supported on: 'ios' 15.0 and later, 'tvos' 15.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)", "/src/CoreVideo/CVBuffer.cs has 4 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'CVBuffer.CVBufferGetAttachment(nint, nint, CVAttachmentMode*)' is obsoleted on: 'ios' 15.0 and later, 'maccatalyst' 15.0 and later, 'macOS/OSX' 12.0 and later, 'tvos' 15.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)", @@ -140,7 +137,7 @@ public partial class ApiAvailabilityTest { "/src/SystemConfiguration/NetworkReachability.cs has 4 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'NetworkReachability.Unschedule(CFRunLoop, string)' is obsoleted on: 'ios' 17.4 and later (Use 'NSUrlSession' or 'NWConnection' instead.), 'maccatalyst' 17.4 and later (Use 'NSUrlSession' or 'NWConnection' instead.), 'macOS/OSX' 14.4 and later (Use 'NSUrlSession' or 'NWConnection' instead.), 'tvos' 17.4 and later (Use 'NSUrlSession' or 'NWConnection' instead.). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)", "/src/UIKit/UICellAccessory.cs has 6 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'UICellAccessory' is supported on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'tvos' 12.2 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)", "/src/UIKit/UIDevice.cs has 2 occurrences of This call site is reachable on all platforms. 'UIDevice.SystemVersion' is supported on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)", - "/src/UIKit/UIFontFeature.cs has 6 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'FontFeatureGroup.LetterCase' is obsoleted on: 'ios' 6.0 and later, 'maccatalyst' 6.0 and later, 'macOS/OSX' 10.7 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)", + "/src/UIKit/UIFontFeature.cs has 6 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'FontFeatureGroup.LetterCase' is obsoleted on: 'ios' 6.0 and later, 'maccatalyst' all versions, 'macOS/OSX' 10.7 and later, 'tvos' all versions. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)", "/src/UIKit/UIImage.cs has 3 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'UIGraphics.BeginImageContext(CGSize)' is unsupported on: 'ios' 17.0 and later, 'maccatalyst' 17.0 and later, 'tvos' 17.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)", "/src/UIKit/UIImage.cs has 3 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'UIGraphics.BeginImageContextWithOptions(CGSize, bool, NFloat)' is unsupported on: 'ios' 17.0 and later, 'maccatalyst' 17.0 and later, 'tvos' 17.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)", "/src/UIKit/UIImage.cs has 6 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'UIGraphics.EndImageContext()' is unsupported on: 'ios' 17.0 and later, 'maccatalyst' 17.0 and later, 'tvos' 17.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)", diff --git a/tests/cecil-tests/ApiAvailabilityTest.cs b/tests/cecil-tests/ApiAvailabilityTest.cs index eb3ca318709e..234d8b370b81 100644 --- a/tests/cecil-tests/ApiAvailabilityTest.cs +++ b/tests/cecil-tests/ApiAvailabilityTest.cs @@ -69,7 +69,7 @@ public void Warnings () } finally { Console.WriteLine ($"There's a total of {totalWarnings} warnings."); } - Assert.AreEqual (813, totalWarnings, "Total warnings"); // this is just to see how the warning count changes as issues are fixed. + Assert.AreEqual (797, totalWarnings, "Total warnings"); // this is just to see how the warning count changes as issues are fixed. } public record ObsoletedFailure : IComparable { @@ -190,18 +190,11 @@ public void FindMissingObsoleteAttributes () "CoreMidi.MidiDevice.Add(System.String, System.Boolean, System.UIntPtr, System.UIntPtr, CoreMidi.MidiEntity)", "CoreMidi.MidiEndpoint.Received(CoreMidi.MidiPacket[])", "CoreMidi.MidiPort.Send(CoreMidi.MidiEndpoint, CoreMidi.MidiPacket[])", - "CoreText.CTFontFeatureLetterCase", - "CoreText.CTFontManager.RegisterFontsForUrl(Foundation.NSUrl[], CoreText.CTFontManagerScope)", - "CoreText.CTFontManager.UnregisterFontsForUrl(Foundation.NSUrl[], CoreText.CTFontManagerScope)", - "CoreText.CTFontManagerAutoActivation CoreText.CTFontManagerAutoActivation::PromptUser", - "CoreText.CTTypesetterOptionKey.get_DisableBidiProcessing()", - "CoreText.FontFeatureGroup CoreText.FontFeatureGroup::LetterCase", "Foundation.NSData HealthKit.HKVerifiableClinicalRecord::JwsRepresentation()", "Foundation.NSDate HealthKit.HKWorkoutEvent::Date()", "Foundation.NSString CoreData.NSPersistentStoreCoordinator::DidImportUbiquitousContentChangesNotification()", "Foundation.NSString CoreData.NSPersistentStoreCoordinator::PersistentStoreUbiquitousContentNameKey()", "Foundation.NSString CoreData.NSPersistentStoreCoordinator::PersistentStoreUbiquitousContentUrlKey()", - "Foundation.NSString CoreText.CTTypesetterOptionKey::DisableBidiProcessing()", "Foundation.NSString Foundation.NSUrl::UbiquitousItemIsDownloadingKey()", "Foundation.NSUrl.get_UbiquitousItemIsDownloadingKey()", "Foundation.NSUrlSessionConfiguration.BackgroundSessionConfiguration(System.String)", @@ -277,7 +270,6 @@ public void FindMissingObsoleteAttributes () "System.Boolean AVFoundation.AVCapturePhotoSettings::DualCameraDualPhotoDeliveryEnabled()", "System.Boolean AVFoundation.AVCaptureResolvedPhotoSettings::DualCameraFusionEnabled()", "System.Boolean CoreGraphics.CGColorSpace::IsHdr()", - "System.Boolean CoreText.CTTypesetterOptions::DisableBidiProcessing()", "System.Boolean NetworkExtension.NEFilterProviderConfiguration::FilterBrowsers()", "System.Boolean Security.SecRecord::UseNoAuthenticationUI()", "System.Double Speech.SFTranscription::AveragePauseDuration()",