Table of Contents

Struct FontFamily

Namespace
SixLabors.Fonts
Assembly
SixLabors.Fonts.dll

Defines a group of type faces having a similar basic design and certain variations in styles.

public struct FontFamily : IEquatable<FontFamily>
Implements
Inherited Members

Properties

Culture

Gets the culture this instance was extracted against.

public readonly CultureInfo Culture { get; }

Property Value

CultureInfo

Name

Gets the name.

public readonly string Name { get; }

Property Value

string

Methods

CreateFont(float)

Create a new instance of the Font for the named font family with regular styling.

public readonly Font CreateFont(float size)

Parameters

size float

The size of the font in PT units.

Returns

Font

The new Font.

CreateFont(float, FontStyle)

Create a new instance of the Font for the named font family.

public readonly Font CreateFont(float size, FontStyle style)

Parameters

size float

The size of the font in PT units.

style FontStyle

The font style.

Returns

Font

The new Font.

CreateFont(float, FontStyle, params FontVariation[])

Create a new instance of the Font for the named font family with the specified style and variation axis settings.

public readonly Font CreateFont(float size, FontStyle style, params FontVariation[] variations)

Parameters

size float

The size of the font in PT units.

style FontStyle

The font style.

variations FontVariation[]

The variation axis settings to apply.

Returns

Font

The new Font.

CreateFont(float, params FontVariation[])

Create a new instance of the Font for the named font family with regular styling and the specified variation axis settings.

public readonly Font CreateFont(float size, params FontVariation[] variations)

Parameters

size float

The size of the font in PT units.

variations FontVariation[]

The variation axis settings to apply.

Returns

Font

The new Font.

Equals(FontFamily)

Indicates whether the current object is equal to another object of the same type.

public readonly bool Equals(FontFamily other)

Parameters

other FontFamily

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

GetAvailableStyles()

Gets the collection of FontStyle that are currently available.

public readonly ReadOnlyMemory<FontStyle> GetAvailableStyles()

Returns

ReadOnlyMemory<FontStyle>

A read-only memory region containing the available font styles.

GetHashCode()

Returns the hash code for this instance.

public override readonly int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

ToString()

Returns the fully qualified type name of this instance.

public override readonly string ToString()

Returns

string

The fully qualified type name.

TryGetMetrics(FontStyle, out FontMetrics?)

Gets the specified font metrics matching the given font style.

public readonly bool TryGetMetrics(FontStyle style, out FontMetrics? metrics)

Parameters

style FontStyle

The font style to use when searching for a match.

metrics FontMetrics

When this method returns, contains the metrics associated with the specified name, if the name is found; otherwise, the default value for the type of the metrics parameter. This parameter is passed uninitialized.

Returns

bool

true if the FontFamily contains font metrics with the specified name; otherwise, false.

TryGetPaths(out ReadOnlyMemory<string>)

Gets the collection of filesystem paths to the font family sources.

public bool TryGetPaths(out ReadOnlyMemory<string> paths)

Parameters

paths ReadOnlyMemory<string>

When this method returns, contains the filesystem paths to the font family sources, if the path exists; otherwise, an empty memory region. This parameter is passed uninitialized.

Returns

bool

true if the FontFamily was created via filesystem paths; otherwise, false.

Operators

operator ==(FontFamily, FontFamily)

Compares two FontFamily objects for equality.

public static bool operator ==(FontFamily left, FontFamily right)

Parameters

left FontFamily

The FontFamily on the left side of the operand.

right FontFamily

The FontFamily on the right side of the operand.

Returns

bool

true if the current left is equal to the right parameter; otherwise, false.

operator !=(FontFamily, FontFamily)

Compares two FontFamily objects for inequality.

public static bool operator !=(FontFamily left, FontFamily right)

Parameters

left FontFamily

The FontFamily on the left side of the operand.

right FontFamily

The FontFamily on the right side of the operand.

Returns

bool

true if the current left is unequal to the right parameter; otherwise, false.