File: Platform\iOS\Extensions\FontExtensions.cs
Web Access
Project: src\src\Controls\src\Core\Controls.Core.csproj (Microsoft.Maui.Controls)
#nullable disable
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Maui.Controls;
using Microsoft.Maui.Controls.Internals;
using ObjCRuntime;
using UIKit;
 
namespace Microsoft.Maui.Controls.Platform
{
	public static partial class FontExtensions
	{
		public static UIFont ToUIFont(this Font self, IFontManager fontManager)
		{
			if (self.IsDefault)
				return fontManager.DefaultFont;
 
			return fontManager.GetFont(self) ?? fontManager.DefaultFont;
		}
 
		public static UIFont ToUIFont<TFontElement>(this TFontElement fontElement) where TFontElement : Element, IFontElement
			=> fontElement.ToFont().ToUIFont(fontElement.RequireFontManager());
	}
}