Font.OfSize(String, Double, FontWeight, FontSlant, Boolean) Method

Definition

Creates a font with the specified family, size, weight, slant, and auto-scaling.

public static Microsoft.Maui.Font OfSize(string? name, double size, Microsoft.Maui.FontWeight weight = Microsoft.Maui.FontWeight.Regular, Microsoft.Maui.FontSlant fontSlant = Microsoft.Maui.FontSlant.Default, bool enableScaling = true);
static member OfSize : string * double * Microsoft.Maui.FontWeight * Microsoft.Maui.FontSlant * bool -> Microsoft.Maui.Font
Public Shared Function OfSize (name As String, size As Double, Optional weight As FontWeight = Microsoft.Maui.FontWeight.Regular, Optional fontSlant As FontSlant = Microsoft.Maui.FontSlant.Default, Optional enableScaling As Boolean = true) As Font

Parameters

name
String

The font family name or system font alias.

size
Double

The desired font size.

weight
FontWeight

The font weight.

fontSlant
FontSlant

The font slant.

enableScaling
Boolean

Whether auto-scaling is enabled.

Returns

A Font instance with the specified settings.

Remarks

Font availability is platform- and device-dependent.

Applies to