FontFace Class

A font face (https://drafts.csswg.org/css-font-loading/#fontface-interface), created by a script or by an @font-face rule of a style sheet of the document (a CSS-connected font face, whose attributes reflect the descriptors of the rule).

public sealed class FontFace

Remarks

Loading a font face fetches its sources (with the DocumentLoader of the browsing context, or from a data: URL) until one of them is a valid font file (an OpenType, TrueType or collection file, WOFF or WOFF2, decoded and validated by the managed font reader). The local() sources are the bundled fonts (the installed fonts of the library, see BundledFonts), matched by full name or PostScript name.

See also

Constructors

NameDescription
FontFace(string, ReadOnlySpan<byte>, FontFaceDescriptors?)Creates a font face from the binary data of a font file.
FontFace(string, string, FontFaceDescriptors?)Creates a font face whose source is a list of URLs (the value of the src descriptor of @font-face, e.g. url(font.woff)).

FontFace overloads

FontFace(string, ReadOnlySpan<byte>, FontFaceDescriptors?)

FontFace.cs

Creates a font face from the binary data of a font file.

public FontFace(string family, ReadOnlySpan<byte> source, FontFaceDescriptors? descriptors = null)

FontFace(string, string, FontFaceDescriptors?)

FontFace.cs

Creates a font face whose source is a list of URLs (the value of the src descriptor of @font-face, e.g. url(font.woff)).

public FontFace(string family, string source, FontFaceDescriptors? descriptors = null)

Properties

NameDescription
AscentOverrideGets or sets the ascent-override descriptor of the font face.
DescentOverrideGets or sets the descent-override descriptor of the font face.
DisplayGets or sets the font-display descriptor of the font face.
FamilyGets or sets the font-family descriptor of the font face.
FeatureSettingsGets or sets the font-feature-settings descriptor of the font face.
FeaturesGets the features of the font face.
LineGapOverrideGets or sets the line-gap-override descriptor of the font face.
LoadedThe [[FontStatusPromise]]: fulfilled when the font face is loaded, rejected when it fails to load.
PalettesGets the color palettes of the font face.
SizeAdjustGets or sets the size-adjust descriptor of the font face.
StatusGets the load status of the font face.
StretchThe legacy name alias of FontFace.Width.
StyleGets or sets the font-style descriptor of the font face.
UnicodeRangeGets or sets the unicode-range descriptor of the font face.
VariationSettingsGets or sets the font-variation-settings descriptor of the font face.
VariationsGets the variation axes of the font face: the axes of the font once it is loaded.
WeightGets or sets the font-weight descriptor of the font face.
WidthGets or sets the font-width descriptor of the font face.

AscentOverride

FontFace.cs

Gets or sets the ascent-override descriptor of the font face.

public string AscentOverride { get; set; }

DescentOverride

FontFace.cs

Gets or sets the descent-override descriptor of the font face.

public string DescentOverride { get; set; }

Gets or sets the font-display descriptor of the font face.

public string Display { get; set; }

Gets or sets the font-family descriptor of the font face.

public string Family { get; set; }

FeatureSettings

FontFace.cs

Gets or sets the font-feature-settings descriptor of the font face.

public string FeatureSettings { get; set; }

Features

FontFace.cs

Gets the features of the font face.

public FontFaceFeatures Features { get; }

LineGapOverride

FontFace.cs

Gets or sets the line-gap-override descriptor of the font face.

public string LineGapOverride { get; set; }

The [[FontStatusPromise]]: fulfilled when the font face is loaded, rejected when it fails to load.

public Task<FontFace> Loaded { get; }

Palettes

FontFace.cs

Gets the color palettes of the font face.

public FontFacePalettes Palettes { get; }

SizeAdjust

FontFace.cs

Gets or sets the size-adjust descriptor of the font face.

public string SizeAdjust { get; set; }

Gets the load status of the font face.

public FontFaceLoadStatus Status { get; }

The legacy name alias of FontFace.Width.

public string Stretch { get; set; }

Gets or sets the font-style descriptor of the font face.

public string Style { get; set; }

UnicodeRange

FontFace.cs

Gets or sets the unicode-range descriptor of the font face.

public string UnicodeRange { get; set; }

VariationSettings

FontFace.cs

Gets or sets the font-variation-settings descriptor of the font face.

public string VariationSettings { get; set; }

Variations

FontFace.cs

Gets the variation axes of the font face: the axes of the font once it is loaded.

public FontFaceVariations Variations { get; }

Gets or sets the font-weight descriptor of the font face.

public string Weight { get; set; }

Gets or sets the font-width descriptor of the font face.

public string Width { get; set; }

Methods

NameDescription
Load()Loads a font face whose source is a list of URLs (https://drafts.csswg.org/css-font-loading/#font-face-load).

Loads a font face whose source is a list of URLs (https://drafts.csswg.org/css-font-loading/#font-face-load).

public Task<FontFace> Load()