Share via


FontCollectionExtensions.AddEmbeddedResourceFont Method

Definition

Adds the font specified in filename from an embedded resource in assembly to the fontCollection, with an optional font alias specified in alias.

public static Microsoft.Maui.Hosting.IFontCollection AddEmbeddedResourceFont (this Microsoft.Maui.Hosting.IFontCollection fontCollection, System.Reflection.Assembly assembly, string filename, string? alias = default);
static member AddEmbeddedResourceFont : Microsoft.Maui.Hosting.IFontCollection * System.Reflection.Assembly * string * string -> Microsoft.Maui.Hosting.IFontCollection
<Extension()>
Public Function AddEmbeddedResourceFont (fontCollection As IFontCollection, assembly As Assembly, filename As String, Optional alias As String = Nothing) As IFontCollection

Parameters

fontCollection
IFontCollection

The collection to add the font to.

assembly
Assembly

The assembly that contains the specified font as an embedded resource.

filename
String

The embedded resource filename of the font to add, such as a True type format (TTF) or open type font (OTF) font file.

alias
String

An optional alias that can also be used to reference this font.

Returns

Exceptions

The filename parameter is null. -or- The assembly parameter is null.

The filename parameter is empty or only whitespace.

Applies to