File: IFontExtensions.cs
Web Access
Project: src\src\Graphics\src\Graphics\Graphics.csproj (Microsoft.Maui.Graphics)
namespace Microsoft.Maui.Graphics
{
	public static class IFontExtensions
	{
		public static string GetSvgWeight(this IFont font)
		{
			if (font == null)
				return null;
 
			if (font.Weight == FontWeights.Normal)
				return "normal";
 
			if (font.Weight == FontWeights.Regular)
				return "normal";
 
			if (font.Weight == FontWeights.Bold)
				return "bold";
 
			return font.Weight.ToInvariantString();
		}
 
		public static string GetSvgStyle(this IFont font)
		{
			if (font == null)
				return null;
 
			if (font.StyleType == FontStyleType.Italic)
				return "italic";
 
			if (font.StyleType == FontStyleType.Oblique)
				return "oblique";
 
			return "normal";
		}
	}
}