Table of Contents

Class FontCollectionBase

Namespace
Avalonia.Media.Fonts
Assembly
Avalonia.Base.dll
public abstract class FontCollectionBase : IFontCollection, IReadOnlyList<FontFamily>, IReadOnlyCollection<FontFamily>, IEnumerable<FontFamily>, IEnumerable, IDisposable
Inheritance
FontCollectionBase
Implements
Derived
Inherited Members

Constructors

FontCollectionBase()

protected FontCollectionBase()

Fields

_glyphTypefaceCache

protected readonly ConcurrentDictionary<string, ConcurrentDictionary<FontCollectionKey, IGlyphTypeface?>> _glyphTypefaceCache

Field Value

ConcurrentDictionary<string, ConcurrentDictionary<FontCollectionKey, IGlyphTypeface>>

Properties

Count

public abstract int Count { get; }

Property Value

int

this[int]

public abstract FontFamily this[int index] { get; }

Parameters

index int

Property Value

FontFamily

Key

Get the font collection's key.

public abstract Uri Key { get; }

Property Value

Uri

Methods

GetEnumerator()

public abstract IEnumerator<FontFamily> GetEnumerator()

Returns

IEnumerator<FontFamily>

Initialize(IFontManagerImpl)

Initializes the font collection.

public abstract void Initialize(IFontManagerImpl fontManager)

Parameters

fontManager IFontManagerImpl

The font manager the collection is registered with.

TryGetGlyphTypeface(string, FontStyle, FontWeight, FontStretch, out IGlyphTypeface?)

Try to get a glyph typeface for given parameters.

public abstract bool TryGetGlyphTypeface(string familyName, FontStyle style, FontWeight weight, FontStretch stretch, out IGlyphTypeface? glyphTypeface)

Parameters

familyName string

The family name.

style FontStyle

The font style.

weight FontWeight

The font weight.

stretch FontStretch

The font stretch.

glyphTypeface IGlyphTypeface

The glyph typeface.

Returns

bool

Returns true if a glyph typface can be found; otherwise, false

TryMatchCharacter(int, FontStyle, FontWeight, FontStretch, string?, CultureInfo?, out Typeface)

Tries to match a specified character to a Typeface that supports specified font properties.

public bool TryMatchCharacter(int codepoint, FontStyle style, FontWeight weight, FontStretch stretch, string? familyName, CultureInfo? culture, out Typeface match)

Parameters

codepoint int

The codepoint to match against.

style FontStyle
weight FontWeight
stretch FontStretch
familyName string

The family name. This is optional and used for fallback lookup.

culture CultureInfo

The culture.

match Typeface

Returns

bool

True, if the FontManager could match the character to specified parameters, False otherwise.