diff --git a/docs/api/UIKit/UIFont.xml b/docs/api/UIKit/UIFont.xml
deleted file mode 100644
index 9a8aa57b3024..000000000000
--- a/docs/api/UIKit/UIFont.xml
+++ /dev/null
@@ -1,140 +0,0 @@
-
-
- Font representation for MonoTouch.UIKit classes.
-
-
- UIFont object are not instantiated directly, but instead are created from static methods on this class. Starting with iOS 7.0 you can use the
- ,
- ,
- ,
- ,
- properties to get the preferred system fonts for the corresponding use case.
-
-
-
-
- Use the static method to create new fonts of a particular font.
-
-
- You can use the property to get a
- list of all family names available and then the
- method to get a list of the fonts available in a particular font family.
-
-
- System Information and Fonts
-
-
- To get a normal, italic of bold fonts representing the system
- font, use the static methods , and
- .
-
-
- You can query some common font parameters by using the , , and .
-
-
-
- Activating Typographic Features
-
- Starting with iOS7, you can retrieve a new font based on
- an existing font instance by using font descriptors. To do
- this, you fetch the immutable property from
- your font and use it to create a new font descriptor with your
- desired changes, which then you use to can pass to the method to
- create the altered font.
-
- The following example shows how to alter the existing
- font to set enable the CoreText typographic features for
- proportional numbers and to use the character alternative:
-
-
-
-
-
- Limiting Character Coverage of a Font
-
-
- The following example alters a font descriptor by altering the
- character set supported by the font and forces the system to
- use a glyph from the list of fallback fonts in the system.
- For example, if you were to use the Menlo font, the following
- example would remove the use of the Melon Snowman character
- (At Unicode 0x2603), and fall back to the system snowman:
-
-
-
-
-
- The members of this class can be used from a background thread.
-
- Enumerate Fonts
- Apple documentation for UIFont
-
-
- Name of one of the built-in system text styles.
- Weakly-typed version of an API used to retrieve the user's desired font size.
- UIFont
-
- You can instead use the
- ,
- ,
- ,
- ,
- properties to get this information.
-
- Using these methods to obtain an initial font during view intiailization is not sufficient to implement dynamic type. After the application user has set the "Text Size Property" in Settings, the application will receive a notification via . It is the application developer's responsibility, at that point, to invalidate the layout in all view elements that should be resized. The simplest way to do that is to have a method that re-sets the font in all components that support Dynamic Type:
-
- {
- SetDynamicTypeFonts();
-});
-
-//Call this when initializing, and also in response to ObserveContentSizeCategoryChanged notifications
-private void SetDynamicTypeFonts()
-{
- headlineLabel.Font = UIFont.PreferredFontForTextStyle(UIFontTextStyle.Headline);
- bodyText.Font = UIFont.PreferredFontForTextStyle(UIFontTextStyle.Body);
- //...etc...
-}
- ]]>
-
- This can be used from a background thread.
-
-
-
\ No newline at end of file
diff --git a/src/UIKit/UIFont.cs b/src/UIKit/UIFont.cs
index 50947f0d9d6a..c8b448efdb8d 100644
--- a/src/UIKit/UIFont.cs
+++ b/src/UIKit/UIFont.cs
@@ -9,12 +9,16 @@
// Copyright 2012-2014 Xamarin Inc. All rights reserved.
//
-// Disable until we get around to enable + fix any issues.
-#nullable disable
+#nullable enable
namespace UIKit {
+ /// Provides extension methods for converting values to their native weight values.
public static class UIFontWeightExtensions {
+ /// Gets the native weight value for the specified .
+ /// The font weight to convert.
+ /// The native weight value corresponding to the specified .
+ /// Thrown when is not a valid value.
public static nfloat GetWeight (this UIFontWeight weight)
{
switch (weight) {
@@ -42,168 +46,225 @@ public static nfloat GetWeight (this UIFontWeight weight)
}
}
+ /// Font representation for UIKit classes.
+ ///
+ ///
+ /// objects are not instantiated directly, but instead are created from static methods on this class.
+ /// You can use the
+ /// ,
+ /// ,
+ /// ,
+ /// ,
+ /// properties to get the preferred system fonts for the corresponding use case.
+ ///
+ ///
+ /// Use the static method to create new fonts of a particular font.
+ ///
+ ///
+ /// You can use the property to get a
+ /// list of all family names available and then the
+ /// method to get a list of the fonts available in a particular font family.
+ ///
+ ///
+ /// System Information and Fonts
+ ///
+ ///
+ /// To get a normal, italic or bold font representing the system font, use the static methods
+ /// ,
+ /// and
+ /// .
+ ///
+ ///
+ /// Activating Typographic Features
+ ///
+ ///
+ /// You can retrieve a new font based on an existing font instance by using font descriptors.
+ /// To do this, you fetch the immutable property from
+ /// your font and use it to create a new font descriptor with your
+ /// desired changes, which then you use to can pass to the
+ /// method to create the altered font.
+ ///
+ ///
+ /// The following example shows how to alter the existing
+ /// font to enable the CoreText typographic features for
+ /// proportional numbers and to use the character alternative:
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Limiting Character Coverage of a Font
+ ///
+ ///
+ /// The following example alters a font descriptor by altering the
+ /// character set supported by the font and forces the system to
+ /// use a glyph from the list of fallback fonts in the system.
+ /// For example, if you were to use the Menlo font, the following
+ /// example would remove the use of the Melon Snowman character
+ /// (At Unicode 0x2603), and fall back to the system snowman:
+ ///
+ ///
+ ///
+ ///
+ /// The members of this class can be used from a background thread.
+ ///
+ /// Apple documentation for UIFont
public partial class UIFont {
/// Returns a string representation of the value of the current instance.
- ///
- ///
- ///
- ///
+ /// A string containing the font name and point size.
public override string ToString ()
{
return String.Format ("{0} {1}", Name, PointSize);
}
- /// The preferred UIFont for the Headline dynamic type.
- ///
- ///
- ///
- /// To implement dynamic type, application developers must act in reaction to (see remarks and example at ).
- /// This can be used from a background thread.
- ///
- [SupportedOSPlatform ("ios")]
- [SupportedOSPlatform ("maccatalyst")]
- [SupportedOSPlatform ("tvos")]
- public static UIFont PreferredHeadline {
+ /// The preferred for the Headline text style.
+ /// The preferred font for headline text.
+ ///
+ /// To implement dynamic type, application developers must act in reaction to (see remarks and example at ).
+ /// This can be used from a background thread.
+ ///
+ public static UIFont? PreferredHeadline {
get {
return GetPreferredFontForTextStyle (UIFontTextStyle.Headline);
}
}
- /// The preferred UIFont for the Body dynamic type.
- ///
- ///
- ///
- /// To implement dynamic type, application developers must act in reaction to (see remarks and example at ).
- /// This can be used from a background thread.
- ///
- [SupportedOSPlatform ("ios")]
- [SupportedOSPlatform ("maccatalyst")]
- [SupportedOSPlatform ("tvos")]
- public static UIFont PreferredBody {
+ /// The preferred for the Body text style.
+ /// The preferred font for body text.
+ ///
+ /// To implement dynamic type, application developers must act in reaction to (see remarks and example at ).
+ /// This can be used from a background thread.
+ ///
+ public static UIFont? PreferredBody {
get {
return GetPreferredFontForTextStyle (UIFontTextStyle.Body);
}
}
- /// The preferred UIFont for the Subheadline dynamic type.
- ///
- ///
- ///
- /// To implement dynamic type, application developers must act in reaction to (see remarks and example at ).
- /// This can be used from a background thread.
- ///
- [SupportedOSPlatform ("ios")]
- [SupportedOSPlatform ("maccatalyst")]
- [SupportedOSPlatform ("tvos")]
- public static UIFont PreferredSubheadline {
+ /// The preferred for the Subheadline text style.
+ /// The preferred font for subheadline text.
+ ///
+ /// To implement dynamic type, application developers must act in reaction to (see remarks and example at ).
+ /// This can be used from a background thread.
+ ///
+ public static UIFont? PreferredSubheadline {
get {
return GetPreferredFontForTextStyle (UIFontTextStyle.Subheadline);
}
}
- /// The preferred UIFont for the Footnote dynamic type.
- ///
- ///
- ///
- /// To implement dynamic type, application developers must act in reaction to (see remarks and example at ).
- /// This can be used from a background thread.
- ///
- [SupportedOSPlatform ("ios")]
- [SupportedOSPlatform ("maccatalyst")]
- [SupportedOSPlatform ("tvos")]
- public static UIFont PreferredFootnote {
+ /// The preferred for the Footnote text style.
+ /// The preferred font for footnote text.
+ ///
+ /// To implement dynamic type, application developers must act in reaction to (see remarks and example at ).
+ /// This can be used from a background thread.
+ ///
+ public static UIFont? PreferredFootnote {
get {
return GetPreferredFontForTextStyle (UIFontTextStyle.Footnote);
}
}
- /// The preferred UIFont for the Caption1 dynamic type.
- ///
- ///
- ///
- /// To implement dynamic type, application developers must act in reaction to (see remarks and example at ).
- /// This can be used from a background thread.
- ///
- [SupportedOSPlatform ("ios")]
- [SupportedOSPlatform ("maccatalyst")]
- [SupportedOSPlatform ("tvos")]
- public static UIFont PreferredCaption1 {
+ /// The preferred for the Caption1 text style.
+ /// The preferred font for primary caption text.
+ ///
+ /// To implement dynamic type, application developers must act in reaction to (see remarks and example at ).
+ /// This can be used from a background thread.
+ ///
+ public static UIFont? PreferredCaption1 {
get {
return GetPreferredFontForTextStyle (UIFontTextStyle.Caption1);
}
}
- /// The preferred UIFont for the Caption2 dynamic type.
- ///
- ///
- ///
- /// To implement dynamic type, application developers must act in reaction to (see remarks and example at ).
- /// This can be used from a background thread.
- ///
- [SupportedOSPlatform ("ios")]
- [SupportedOSPlatform ("maccatalyst")]
- [SupportedOSPlatform ("tvos")]
- public static UIFont PreferredCaption2 {
+ /// The preferred for the Caption2 text style.
+ /// The preferred font for secondary caption text.
+ ///
+ /// To implement dynamic type, application developers must act in reaction to (see remarks and example at ).
+ /// This can be used from a background thread.
+ ///
+ public static UIFont? PreferredCaption2 {
get {
return GetPreferredFontForTextStyle (UIFontTextStyle.Caption2);
}
}
- /// The preferred UIFont for the Title1 dynamic type.
- /// To be added.
- ///
- /// (More documentation for this node is coming)
- /// This can be used from a background thread.
- ///
- [SupportedOSPlatform ("ios")]
- [SupportedOSPlatform ("maccatalyst")]
- [SupportedOSPlatform ("tvos")]
- public static UIFont PreferredTitle1 {
+ /// The preferred for the Title1 text style.
+ /// The preferred font for primary title text.
+ ///
+ /// This can be used from a background thread.
+ ///
+ public static UIFont? PreferredTitle1 {
get {
return GetPreferredFontForTextStyle (UIFontTextStyle.Title1);
}
}
- /// The preferred UIFont for the Title2 dynamic type.
- /// To be added.
- ///
- /// (More documentation for this node is coming)
- /// This can be used from a background thread.
- ///
- [SupportedOSPlatform ("ios")]
- [SupportedOSPlatform ("maccatalyst")]
- [SupportedOSPlatform ("tvos")]
- public static UIFont PreferredTitle2 {
+ /// The preferred for the Title2 text style.
+ /// The preferred font for secondary title text.
+ ///
+ /// This can be used from a background thread.
+ ///
+ public static UIFont? PreferredTitle2 {
get {
return GetPreferredFontForTextStyle (UIFontTextStyle.Title2);
}
}
- /// The preferred UIFont for the Title3 dynamic type.
- /// To be added.
- ///
- /// (More documentation for this node is coming)
- /// This can be used from a background thread.
- ///
- [SupportedOSPlatform ("ios")]
- [SupportedOSPlatform ("maccatalyst")]
- [SupportedOSPlatform ("tvos")]
- public static UIFont PreferredTitle3 {
+ /// The preferred for the Title3 text style.
+ /// The preferred font for tertiary title text.
+ ///
+ /// This can be used from a background thread.
+ ///
+ public static UIFont? PreferredTitle3 {
get {
return GetPreferredFontForTextStyle (UIFontTextStyle.Title3);
}
}
- /// The preferred UIFont for the Callout dynamic type.
- /// To be added.
- ///
- /// (More documentation for this node is coming)
- /// This can be used from a background thread.
- ///
- [SupportedOSPlatform ("ios")]
- [SupportedOSPlatform ("maccatalyst")]
- [SupportedOSPlatform ("tvos")]
- public static UIFont PreferredCallout {
+ /// The preferred for the Callout text style.
+ /// The preferred font for callout text.
+ ///
+ /// This can be used from a background thread.
+ ///
+ public static UIFont? PreferredCallout {
get {
return GetPreferredFontForTextStyle (UIFontTextStyle.Callout);
}
@@ -228,293 +289,278 @@ static nfloat GetFontWidth (UIFontWidth width)
}
}
- /// To be added.
- /// To be added.
- /// Gets the system font for specified and .
- /// To be added.
+ /// Gets the system font for the specified and .
+ /// The size of the font in points.
+ /// The weight of the font.
+ /// The system font with the specified size and weight.
///
- /// (More documentation for this node is coming)
- /// This can be used from a background thread.
- ///
- [SupportedOSPlatform ("ios")]
- [SupportedOSPlatform ("maccatalyst")]
- [SupportedOSPlatform ("tvos")]
- public static UIFont SystemFontOfSize (nfloat size, UIFontWeight weight)
+ /// This can be used from a background thread.
+ ///
+ public static UIFont? SystemFontOfSize (nfloat size, UIFontWeight weight)
{
return SystemFontOfSize (size, weight.GetWeight ());
}
- /// To be added.
- /// To be added.
- /// The system monospaced font specialized for digits, in the specified size and weight.
- /// To be added.
+ /// Returns the system monospaced font specialized for digits, in the specified size and weight.
+ /// The size of the font in points.
+ /// The weight of the font.
+ /// The monospaced digit system font, or if the font could not be created.
///
- /// (More documentation for this node is coming)
- /// This can be used from a background thread.
- ///
- [SupportedOSPlatform ("ios")]
- [SupportedOSPlatform ("maccatalyst")]
- [SupportedOSPlatform ("tvos")]
- public static UIFont MonospacedDigitSystemFontOfSize (nfloat size, nfloat weight)
+ /// This can be used from a background thread.
+ ///
+ public static UIFont? MonospacedDigitSystemFontOfSize (nfloat size, nfloat weight)
{
var ptr = _MonospacedDigitSystemFontOfSize (size, weight);
return ptr == IntPtr.Zero ? null : new UIFont (ptr);
}
- /// To be added.
- /// To be added.
- /// Gets the monospaced preferred by the system for displaying digits, of the specified and .
- /// To be added.
+ /// Gets the monospaced preferred by the system for displaying digits, of the specified and .
+ /// The size of the font in points.
+ /// The weight of the font.
+ /// The monospaced digit system font, or if the font could not be created.
///
- /// (More documentation for this node is coming)
- /// This can be used from a background thread.
- ///
- [SupportedOSPlatform ("ios")]
- [SupportedOSPlatform ("maccatalyst")]
- [SupportedOSPlatform ("tvos")]
- public static UIFont MonospacedDigitSystemFontOfSize (nfloat fontSize, UIFontWeight weight)
+ /// This can be used from a background thread.
+ ///
+ public static UIFont? MonospacedDigitSystemFontOfSize (nfloat fontSize, UIFontWeight weight)
{
return MonospacedDigitSystemFontOfSize (fontSize, weight.GetWeight ());
}
+ /// Gets the monospaced system font of the specified size and weight.
+ /// The size of the font in points.
+ /// The weight of the font.
+ /// The monospaced system font, or if the font could not be created.
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("maccatalyst")]
- public static UIFont GetMonospacedSystemFont (nfloat size, nfloat weight)
+ public static UIFont? GetMonospacedSystemFont (nfloat size, nfloat weight)
{
var ptr = _MonospacedSystemFontOfSize (size, weight);
return ptr == IntPtr.Zero ? null : new UIFont (ptr);
}
+ /// Gets the monospaced system font of the specified size and weight.
+ /// The size of the font in points.
+ /// The weight of the font.
+ /// The monospaced system font, or if the font could not be created.
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("maccatalyst")]
- public static UIFont GetMonospacedSystemFont (nfloat size, UIFontWeight weight) => GetMonospacedSystemFont (size, weight.GetWeight ());
+ public static UIFont? GetMonospacedSystemFont (nfloat size, UIFontWeight weight) => GetMonospacedSystemFont (size, weight.GetWeight ());
// In this case we want to _always_ return a different managed instance
// so one can be disposed without affecting others
// ref: https://bugzilla.xamarin.com/show_bug.cgi?id=25511
- ///
- [SupportedOSPlatform ("ios")]
- [SupportedOSPlatform ("maccatalyst")]
- [SupportedOSPlatform ("tvos")]
- public static UIFont GetPreferredFontForTextStyle (NSString uiFontTextStyle)
+ /// Gets the preferred font for the specified text style.
+ /// Name of one of the built-in system text styles.
+ /// The preferred for the specified text style, or if the font could not be created.
+ ///
+ /// You can instead use the , , , , properties to get this information.
+ /// Using these methods to obtain an initial font during view initialization is not sufficient to implement dynamic type. After the application user has set the "Text Size Property" in Settings, the application will receive a notification via . It is the application developer's responsibility, at that point, to invalidate the layout in all view elements that should be resized. The simplest way to do that is to have a method that re-sets the font in all components that support Dynamic Type:
+ ///
+ /// {
+ /// SetDynamicTypeFonts();
+ /// });
+ ///
+ /// //Call this when initializing, and also in response to ObserveContentSizeCategoryChanged notifications
+ /// private void SetDynamicTypeFonts()
+ /// {
+ /// headlineLabel.Font = UIFont.PreferredFontForTextStyle(UIFontTextStyle.Headline);
+ /// bodyText.Font = UIFont.PreferredFontForTextStyle(UIFontTextStyle.Body);
+ /// //...etc...
+ /// }
+ /// ]]>
+ ///
+ /// This can be used from a background thread.
+ ///
+ public static UIFont? GetPreferredFontForTextStyle (NSString uiFontTextStyle)
{
var ptr = _GetPreferredFontForTextStyle (uiFontTextStyle);
return ptr == IntPtr.Zero ? null : new UIFont (ptr);
}
+ /// Gets the preferred font for the specified text style.
/// The style for which to get the preferred font.
- /// Weakly-typed version of an API used to retrieve the user's desired font size.
- /// To be added.
- ///
- /// (More documentation for this node is coming)
- /// This can be used from a background thread.
- ///
- [SupportedOSPlatform ("ios")]
- [SupportedOSPlatform ("maccatalyst")]
- [SupportedOSPlatform ("tvos")]
- public static UIFont GetPreferredFontForTextStyle (UIFontTextStyle uiFontTextStyle)
+ /// The preferred for the specified text style.
+ ///
+ /// This can be used from a background thread.
+ ///
+ public static UIFont? GetPreferredFontForTextStyle (UIFontTextStyle uiFontTextStyle)
{
- return GetPreferredFontForTextStyle (uiFontTextStyle.GetConstant ());
+ return GetPreferredFontForTextStyle (uiFontTextStyle.GetConstant ()!);
}
+ /// Gets the preferred font for the specified text style and trait collection.
/// The style for which to get the preferred font.
- /// The trait collection for which to get the preferred font.
- /// Weakly-typed version of an API used to retrieve the user's desired font size.
- /// To be added.
- ///
- /// (More documentation for this node is coming)
- /// This can be used from a background thread.
- ///
- [SupportedOSPlatform ("ios")]
- [SupportedOSPlatform ("maccatalyst")]
- [SupportedOSPlatform ("tvos")]
- public static UIFont GetPreferredFontForTextStyle (NSString uiFontTextStyle, UITraitCollection traitCollection)
+ /// The trait collection for which to get the preferred font.
+ /// The preferred for the specified text style and trait collection, or if the font could not be created.
+ ///
+ /// This can be used from a background thread.
+ ///
+ public static UIFont? GetPreferredFontForTextStyle (NSString uiFontTextStyle, UITraitCollection traitCollection)
{
var ptr = _GetPreferredFontForTextStyle (uiFontTextStyle, traitCollection);
return ptr == IntPtr.Zero ? null : new UIFont (ptr);
}
+ /// Gets the that is preferred by the system for the specified and .
/// The style for which to get the preferred font.
- /// The trait collection for which to get the preferred font.
- /// Gets the that is preferred by the system for and .
- /// To be added.
- ///
- /// (More documentation for this node is coming)
- /// This can be used from a background thread.
- ///
- [SupportedOSPlatform ("ios")]
- [SupportedOSPlatform ("maccatalyst")]
- [SupportedOSPlatform ("tvos")]
- public static UIFont GetPreferredFontForTextStyle (UIFontTextStyle uiFontTextStyle, UITraitCollection traitCollection)
+ /// The trait collection for which to get the preferred font.
+ /// The preferred for the specified text style and trait collection.
+ ///
+ /// This can be used from a background thread.
+ ///
+ public static UIFont? GetPreferredFontForTextStyle (UIFontTextStyle uiFontTextStyle, UITraitCollection traitCollection)
{
- return GetPreferredFontForTextStyle (uiFontTextStyle.GetConstant (), traitCollection);
+ return GetPreferredFontForTextStyle (uiFontTextStyle.GetConstant ()!, traitCollection);
}
- /// To be added.
- /// To be added.
- /// Factory method that creates a UIFont from the specified descriptor.
- /// To be added.
+ /// Creates a from the specified font descriptor.
+ /// The font descriptor describing the font to create.
+ /// The point size of the font to create. If 0, the size from the descriptor is used.
+ /// A new based on the descriptor, or if the font could not be created.
///
- /// (More documentation for this node is coming)
- /// This can be used from a background thread.
- ///
- [SupportedOSPlatform ("ios")]
- [SupportedOSPlatform ("maccatalyst")]
- [SupportedOSPlatform ("tvos")]
- public static UIFont FromDescriptor (UIFontDescriptor descriptor, nfloat pointSize)
+ /// This can be used from a background thread.
+ ///
+ public static UIFont? FromDescriptor (UIFontDescriptor descriptor, nfloat pointSize)
{
var ptr = _FromDescriptor (descriptor, pointSize);
return ptr == IntPtr.Zero ? null : new UIFont (ptr);
}
+ /// Creates a font with the specified name and size.
/// The name of the font to create.
- /// The size of the font to create.
- /// Creates a font of the specified size.
- ///
- ///
+ /// The size of the font in points.
+ /// A new with the specified name and size, or if the font could not be found.
///
- ///
- ///
- /// This can be used from a background thread.
- ///
- public static UIFont FromName (string name, nfloat size)
+ /// This can be used from a background thread.
+ ///
+ public static UIFont? FromName (string name, nfloat size)
{
var ptr = _FromName (name, size);
return ptr == IntPtr.Zero ? null : new UIFont (ptr);
}
- /// The size of the font, as measure in points.
/// Creates a system font of the specified size.
- ///
- ///
+ /// The size of the font in points.
+ /// A new system of the specified size, or if the font could not be created.
///
- ///
- ///
- /// This can be used from a background thread.
- ///
- public static UIFont SystemFontOfSize (nfloat size)
+ /// This can be used from a background thread.
+ ///
+ public static UIFont? SystemFontOfSize (nfloat size)
{
var ptr = _SystemFontOfSize (size);
return ptr == IntPtr.Zero ? null : new UIFont (ptr);
}
+ /// Creates a system font of the specified size, weight, and width.
+ /// The size of the font in points.
+ /// The weight of the font.
+ /// The width of the font.
+ /// A new system of the specified size, weight, and width, or if the font could not be created.
[SupportedOSPlatform ("ios16.0")]
[SupportedOSPlatform ("maccatalyst16.0")]
[SupportedOSPlatform ("tvos16.0")]
- public static UIFont SystemFontOfSize (nfloat fontSize, UIFontWeight weight, UIFontWidth width)
+ public static UIFont? SystemFontOfSize (nfloat fontSize, UIFontWeight weight, UIFontWidth width)
{
var ptr = _SystemFontOfSize (fontSize, weight.GetWeight (), GetFontWidth (width));
return ptr == IntPtr.Zero ? null : new UIFont (ptr);
}
- /// To be added.
- /// To be added.
- /// Returns the default system font in specified and .
- /// To be added.
+ /// Returns the default system font in the specified and .
+ /// The size of the font in points.
+ /// The weight of the font.
+ /// A new system of the specified size and weight, or if the font could not be created.
///
- /// (More documentation for this node is coming)
- /// This can be used from a background thread.
- ///
- [SupportedOSPlatform ("ios")]
- [SupportedOSPlatform ("maccatalyst")]
- [SupportedOSPlatform ("tvos")]
- public static UIFont SystemFontOfSize (nfloat size, nfloat weight)
+ /// This can be used from a background thread.
+ ///
+ public static UIFont? SystemFontOfSize (nfloat size, nfloat weight)
{
var ptr = _SystemFontOfSize (size, weight);
return ptr == IntPtr.Zero ? null : new UIFont (ptr);
}
- /// The size of the font.
- /// Returns a boldfaced font of the standard system font in the size specified.
- ///
- ///
+ /// Returns a bold system font of the specified size.
+ /// The size of the font in points.
+ /// A new bold system of the specified size, or if the font could not be created.
///
- ///
- ///
- /// This can be used from a background thread.
- ///
- public static UIFont BoldSystemFontOfSize (nfloat size)
+ /// This can be used from a background thread.
+ ///
+ public static UIFont? BoldSystemFontOfSize (nfloat size)
{
var ptr = _BoldSystemFontOfSize (size);
return ptr == IntPtr.Zero ? null : new UIFont (ptr);
}
- /// The size of the font to create.
/// Creates an italicized system font of the specified size.
- ///
- ///
+ /// The size of the font in points.
+ /// A new italic system of the specified size, or if the font could not be created.
///
- ///
- ///
- /// This can be used from a background thread.
- ///
- public static UIFont ItalicSystemFontOfSize (nfloat size)
+ /// This can be used from a background thread.
+ ///
+ public static UIFont? ItalicSystemFontOfSize (nfloat size)
{
var ptr = _ItalicSystemFontOfSize (size);
return ptr == IntPtr.Zero ? null : new UIFont (ptr);
}
- /// The new font size (in points).
- /// Returns a new font based on the current one, with the new specified size.
- /// The new font at the specified size.
+ /// Returns a new font based on the current one, with the specified size.
+ /// The new font size in points.
+ /// A new with the same characteristics as this font but with the specified size, or if the font could not be created.
///
- /// This can be used from a background thread.
- ///
- public virtual UIFont WithSize (nfloat size)
+ /// This can be used from a background thread.
+ ///
+ public virtual UIFont? WithSize (nfloat size)
{
var ptr = _WithSize (size);
return ptr == IntPtr.Zero ? null : new UIFont (ptr);
}
- /// To be added.
- /// To be added.
- /// Compares two objects for value equality.
- /// To be added.
+ /// Compares two objects for value equality.
+ /// The first font to compare.
+ /// The second font to compare.
+ /// if the two fonts are equal; otherwise, .
///
- /// (More documentation for this node is coming)
- /// This can be used from a background thread.
- ///
- public static bool operator == (UIFont f1, UIFont f2)
+ /// This can be used from a background thread.
+ ///
+ public static bool operator == (UIFont? f1, UIFont? f2)
{
- if (((object) f1) is null)
- return ((object) f2) is null;
- else if ((object) f2 is null)
+ if (f1 is null)
+ return f2 is null;
+ else if (f2 is null)
return false;
return f1.Handle == f2.Handle;
}
- /// To be added.
- /// To be added.
- /// Compares two objects for value inequality.
- /// To be added.
+ /// Compares two objects for value inequality.
+ /// The first font to compare.
+ /// The second font to compare.
+ /// if the two fonts are not equal; otherwise, .
///
- /// (More documentation for this node is coming)
- /// This can be used from a background thread.
- ///
- public static bool operator != (UIFont f1, UIFont f2)
+ /// This can be used from a background thread.
+ ///
+ public static bool operator != (UIFont? f1, UIFont? f2)
{
return !(f1 == f2);
}
- /// To be added.
- /// Used to compare objects.
- /// To be added.
- ///
- /// (More documentation for this node is coming)
- /// This can be used from a background thread.
- ///
- public override bool Equals (object obj)
+ /// Determines whether the specified object is equal to the current .
+ /// The object to compare with the current font.
+ /// if the specified object is equal to the current font; otherwise, .
+ ///
+ /// This can be used from a background thread.
+ ///
+ public override bool Equals (object? obj)
{
- UIFont font = (obj as UIFont);
+ var font = obj as UIFont;
return this == font;
}
/// Generates a hash code for the current instance.
- /// A int containing the hash code for this instance.
- /// The algorithm used to generate the hash code is unspecified.
+ /// A hash code for this instance.
+ /// The algorithm used to generate the hash code is unspecified.
public override int GetHashCode ()
{
return GetNativeHash ().GetHashCode ();
diff --git a/tests/cecil-tests/Documentation.KnownFailures.txt b/tests/cecil-tests/Documentation.KnownFailures.txt
index e3b91dd4a71f..a8ec7d1aa4d6 100644
--- a/tests/cecil-tests/Documentation.KnownFailures.txt
+++ b/tests/cecil-tests/Documentation.KnownFailures.txt
@@ -17132,14 +17132,10 @@ M:UIKit.UIFocusItem_Extensions.GetFocusItemDeferralMode(UIKit.IUIFocusItem)
M:UIKit.UIFocusItem_Extensions.GetIsTransparentFocusItem(UIKit.IUIFocusItem)
M:UIKit.UIFocusSystem.Dispose(System.Boolean)
M:UIKit.UIFocusUpdateContext.Dispose(System.Boolean)
-M:UIKit.UIFont.GetMonospacedSystemFont(System.Runtime.InteropServices.NFloat,System.Runtime.InteropServices.NFloat)
-M:UIKit.UIFont.GetMonospacedSystemFont(System.Runtime.InteropServices.NFloat,UIKit.UIFontWeight)
-M:UIKit.UIFont.SystemFontOfSize(System.Runtime.InteropServices.NFloat,UIKit.UIFontWeight,UIKit.UIFontWidth)
M:UIKit.UIFontDescriptor.CreateWithDesign(UIKit.UIFontDescriptorSystemDesign)
M:UIKit.UIFontPickerViewController.Dispose(System.Boolean)
M:UIKit.UIFontPickerViewControllerDelegate_Extensions.DidCancel(UIKit.IUIFontPickerViewControllerDelegate,UIKit.UIFontPickerViewController)
M:UIKit.UIFontPickerViewControllerDelegate_Extensions.DidPickFont(UIKit.IUIFontPickerViewControllerDelegate,UIKit.UIFontPickerViewController)
-M:UIKit.UIFontWeightExtensions.GetWeight(UIKit.UIFontWeight)
M:UIKit.UIGestureRecognizer.Dispose(System.Boolean)
M:UIKit.UIGestureRecognizerDelegate_Extensions.ShouldReceiveEvent(UIKit.IUIGestureRecognizerDelegate,UIKit.UIGestureRecognizer,UIKit.UIEvent)
M:UIKit.UIGraphics.BeginImageContextWithOptions(CoreGraphics.CGSize,System.Boolean,System.Runtime.InteropServices.NFloat)
@@ -28582,7 +28578,6 @@ T:UIKit.UIFocusItemDeferralMode
T:UIKit.UIFocusSoundIdentifier
T:UIKit.UIFontDescriptorSystemDesign
T:UIKit.UIFontWeightConstants
-T:UIKit.UIFontWeightExtensions
T:UIKit.UIFontWidth
T:UIKit.UIGestureProbe
T:UIKit.UIGesturesEvent