Table of Contents

Class FontFamily

Namespace
Avalonia.Media
Assembly
Avalonia.Base.dll
public sealed class FontFamily
Inheritance
FontFamily
Inherited Members

Constructors

FontFamily(string)

Initializes a new instance of the FontFamily class.

public FontFamily(string name)

Parameters

name string

The name of the FontFamily.

FontFamily(Uri?, string)

Initializes a new instance of the FontFamily class.

public FontFamily(Uri? baseUri, string name)

Parameters

baseUri Uri

Specifies the base uri that is used to resolve font family assets.

name string

The name of the FontFamily.

Exceptions

ArgumentException

Base uri must be an absolute uri.

Fields

DefaultFontFamilyName

public const string DefaultFontFamilyName = "$Default"

Field Value

string

Properties

Default

Represents the default font family

public static FontFamily Default { get; }

Property Value

FontFamily

FamilyNames

Gets the family names.

public FamilyNameCollection FamilyNames { get; }

Property Value

FamilyNameCollection

The family familyNames.

FamilyTypefaces

Gets the typefaces for this font family.

public IReadOnlyList<Typeface> FamilyTypefaces { get; }

Property Value

IReadOnlyList<Typeface>

Key

Gets the key for associated assets.

public FontFamilyKey? Key { get; }

Property Value

FontFamilyKey

The family key.

Remarks

Key is only used for custom fonts.

Name

Gets the primary family name of the font family.

public string Name { get; }

Property Value

string

The primary name of the font family.

Methods

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

Returns a hash code for this instance.

public override int GetHashCode()

Returns

int

A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.

Parse(string)

Parses a FontFamily string.

public static FontFamily Parse(string s)

Parameters

s string

The FontFamily string.

Returns

FontFamily

Exceptions

ArgumentException

Specified family is not supported.

Parse(string, Uri?)

Parses a FontFamily string.

public static FontFamily Parse(string s, Uri? baseUri)

Parameters

s string

The FontFamily string.

baseUri Uri

Specifies the base uri that is used to resolve font family assets.

Returns

FontFamily

Exceptions

ArgumentException

Specified family is not supported.

ToString()

Returns a string that represents this instance.

public override string ToString()

Returns

string

A string that represents this instance.

Operators

operator ==(FontFamily?, FontFamily?)

public static bool operator ==(FontFamily? a, FontFamily? b)

Parameters

a FontFamily
b FontFamily

Returns

bool

implicit operator FontFamily(string)

Implicit conversion of string to FontFamily

public static implicit operator FontFamily(string s)

Parameters

s string

Returns

FontFamily

operator !=(FontFamily?, FontFamily?)

public static bool operator !=(FontFamily? a, FontFamily? b)

Parameters

a FontFamily
b FontFamily

Returns

bool