diff --git a/src/CoreText/CTFont.cs b/src/CoreText/CTFont.cs
index c6f07569c765..e83687ce9604 100644
--- a/src/CoreText/CTFont.cs
+++ b/src/CoreText/CTFont.cs
@@ -2989,6 +2989,19 @@ public CTFontSymbolicTraits SymbolicTraits {
get { return CTFontGetSymbolicTraits (Handle); }
}
+ [DllImport (Constants.CoreTextLibrary)]
+ static extern CTFontUIFontType CTFontGetUIFontType (IntPtr font);
+
+ /// Gets the UI font type of the font.
+ /// The UI font type, or if the font is not a UI font.
+ [SupportedOSPlatform ("ios26.4")]
+ [SupportedOSPlatform ("maccatalyst26.4")]
+ [SupportedOSPlatform ("macos26.4")]
+ [SupportedOSPlatform ("tvos26.4")]
+ public CTFontUIFontType UIFontType {
+ get { return CTFontGetUIFontType (GetCheckedHandle ()); }
+ }
+
[DllImport (Constants.CoreTextLibrary)]
static extern IntPtr CTFontCopyTraits (IntPtr font);
/// To be added.
diff --git a/src/CoreText/CTFontDescriptor.cs b/src/CoreText/CTFontDescriptor.cs
index 64bfae986123..bb33b66d3ed2 100644
--- a/src/CoreText/CTFontDescriptor.cs
+++ b/src/CoreText/CTFontDescriptor.cs
@@ -329,6 +329,16 @@ public IEnumerable? Languages {
set { Adapter.SetValue (Dictionary, CTFontDescriptorAttributeKey.Languages!, value); }
}
+ /// The language of the font descriptor.
+ [SupportedOSPlatform ("ios26.4")]
+ [SupportedOSPlatform ("maccatalyst26.4")]
+ [SupportedOSPlatform ("macos26.4")]
+ [SupportedOSPlatform ("tvos26.4")]
+ public string? Language {
+ get { return Adapter.GetStringValue (Dictionary, CTFontDescriptorAttributeKey.Language); }
+ set { Adapter.SetValue (Dictionary, CTFontDescriptorAttributeKey.Language!, value); }
+ }
+
// float represented as a CFNumber
/// The Baseline Adjustment.
///
diff --git a/src/coretext.cs b/src/coretext.cs
index 6e2cafb60614..054df57d1a15 100644
--- a/src/coretext.cs
+++ b/src/coretext.cs
@@ -343,6 +343,10 @@ interface CTFontDescriptorAttributeKey {
[iOS (13, 0), NoTV, MacCatalyst (13, 1), NoMac]
[Field ("kCTFontRegistrationUserInfoAttribute")]
NSString RegistrationUserInfo { get; }
+
+ [iOS (26, 4), TV (26, 4), Mac (26, 4), MacCatalyst (26, 4)]
+ [Field ("kCTFontDescriptorLanguageAttribute")]
+ NSString Language { get; }
}
/// A class whose static properties can be used as keys for the used by .
diff --git a/tests/monotouch-test/CoreText/FontDescriptorTest.cs b/tests/monotouch-test/CoreText/FontDescriptorTest.cs
index 461b40427325..3bae08d6a4a7 100644
--- a/tests/monotouch-test/CoreText/FontDescriptorTest.cs
+++ b/tests/monotouch-test/CoreText/FontDescriptorTest.cs
@@ -94,5 +94,18 @@ public void MatchFontDescriptors ()
Assert.IsTrue (rv, "Return value");
TestRuntime.RunAsync (TimeSpan.FromSeconds (30), tcs.Task);
}
+
+ [Test]
+ public void LanguageAttribute ()
+ {
+ TestRuntime.AssertXcodeVersion (26, 4);
+ var fda = new CTFontDescriptorAttributes () {
+ FamilyName = "Courier",
+ Language = "en",
+ };
+ using var fd = new CTFontDescriptor (fda);
+ var attrs = fd.GetAttributes ();
+ Assert.That (attrs.Language, Is.EqualTo ("en"), "Language");
+ }
}
}
diff --git a/tests/monotouch-test/CoreText/FontTest.cs b/tests/monotouch-test/CoreText/FontTest.cs
index b8593972e5c1..bc18e97eb113 100644
--- a/tests/monotouch-test/CoreText/FontTest.cs
+++ b/tests/monotouch-test/CoreText/FontTest.cs
@@ -198,5 +198,21 @@ public void GetVariationAxes ()
Assert.That (axes.Length, Is.EqualTo (0), "Length");
}
}
+
+ [Test]
+ public void UIFontType_SystemFont ()
+ {
+ TestRuntime.AssertXcodeVersion (26, 4);
+ using var font = new CTFont (CTFontUIFontType.System, 12, "en");
+ Assert.That (font.UIFontType, Is.EqualTo (CTFontUIFontType.System), "System");
+ }
+
+ [Test]
+ public void UIFontType_RegularFont ()
+ {
+ TestRuntime.AssertXcodeVersion (26, 4);
+ using var font = new CTFont ("HoeflerText-Regular", 10);
+ Assert.That (font.UIFontType, Is.EqualTo (CTFontUIFontType.None), "None");
+ }
}
}
diff --git a/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-CoreText.todo b/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-CoreText.todo
deleted file mode 100644
index d23575f96b19..000000000000
--- a/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-CoreText.todo
+++ /dev/null
@@ -1,2 +0,0 @@
-!missing-field! kCTFontDescriptorLanguageAttribute not bound
-!missing-pinvoke! CTFontGetUIFontType is not bound
diff --git a/tests/xtro-sharpie/api-annotations-dotnet/iOS-CoreText.todo b/tests/xtro-sharpie/api-annotations-dotnet/iOS-CoreText.todo
deleted file mode 100644
index d23575f96b19..000000000000
--- a/tests/xtro-sharpie/api-annotations-dotnet/iOS-CoreText.todo
+++ /dev/null
@@ -1,2 +0,0 @@
-!missing-field! kCTFontDescriptorLanguageAttribute not bound
-!missing-pinvoke! CTFontGetUIFontType is not bound
diff --git a/tests/xtro-sharpie/api-annotations-dotnet/macOS-CoreText.todo b/tests/xtro-sharpie/api-annotations-dotnet/macOS-CoreText.todo
deleted file mode 100644
index d23575f96b19..000000000000
--- a/tests/xtro-sharpie/api-annotations-dotnet/macOS-CoreText.todo
+++ /dev/null
@@ -1,2 +0,0 @@
-!missing-field! kCTFontDescriptorLanguageAttribute not bound
-!missing-pinvoke! CTFontGetUIFontType is not bound
diff --git a/tests/xtro-sharpie/api-annotations-dotnet/tvOS-CoreText.todo b/tests/xtro-sharpie/api-annotations-dotnet/tvOS-CoreText.todo
deleted file mode 100644
index d23575f96b19..000000000000
--- a/tests/xtro-sharpie/api-annotations-dotnet/tvOS-CoreText.todo
+++ /dev/null
@@ -1,2 +0,0 @@
-!missing-field! kCTFontDescriptorLanguageAttribute not bound
-!missing-pinvoke! CTFontGetUIFontType is not bound