SystemFontDescriptor Class

A face of a font installed on the machine: the file that holds it, and its names and its style, read without loading the font.

public sealed class SystemFontDescriptor

Remarks

A descriptor is immutable and can be used by several threads at the same time. To use the face, load SystemFontDescriptor.FilePath and take the face at SystemFontDescriptor.FaceIndex. The file may have changed or been removed since the fonts were scanned: loading it can fail.

The characters of the face (SystemFontDescriptor.Covers) are read from its file the first time they are asked for, not when the fonts are scanned.

Properties

NameDescription
AxesGets the axes of a variable font, empty for a font that is not variable.
FaceIndexGets the index of the face in the file: 0, or its index in a font collection.
FamilyNameGets the preferred family name: the typographic family name, else the family name, else an empty string.
FamilyNamesGets the names the face is found by in SystemFontCollection.GetFamily: the typographic family names and the family names, in every language of the name table, each one once.
FilePathGets the full path of the font file.
FullNameGets the full name of the face (name 4 of the name table), or null when the font has none.
HasOs2Gets whether the face has an OS/2 table.
IsItalicGets whether the face is italic: bit 0 of OS/2.fsSelection, else bit 1 of head.macStyle.
IsMonospacedGets whether the face is monospaced (post.isFixedPitch).
IsObliqueGets whether the face is oblique rather than italic: bit 9 of OS/2.fsSelection.
ItalicAngleGets the italic angle of the post table, in degrees counter-clockwise from the vertical.
MacStyleGets the head.macStyle field.
PostScriptNameGets the PostScript name of the face, or null when the font has none.
SelectionGets the OS/2.fsSelection field, 0 without an OS/2 table.
SubfamilyNameGets the preferred subfamily name, such as Bold Italic, else an empty string.
WeightGets the weight class: OS/2.usWeightClass, else 700 or 400 from head.macStyle.
WidthClassGets the width class, OS/2.usWidthClass: from 1 (ultra-condensed) to 9 (ultra-expanded), 5 without an OS/2 table.

Gets the axes of a variable font, empty for a font that is not variable.

public ReadOnlySpan<FontAxisRecord> Axes { get; }

Gets the index of the face in the file: 0, or its index in a font collection.

public int FaceIndex { get; }

Property value

int

Gets the preferred family name: the typographic family name, else the family name, else an empty string.

public string FamilyName { get; }

Property value

string

Remarks

It is FontFace.FamilyName of the face.

Gets the names the face is found by in SystemFontCollection.GetFamily: the typographic family names and the family names, in every language of the name table, each one once.

public IReadOnlyList<string> FamilyNames { get; }

Property value

IReadOnlyList<string>

Gets the full path of the font file.

public string FilePath { get; }

Property value

string

Gets the full name of the face (name 4 of the name table), or null when the font has none.

public string? FullName { get; }

Property value

string?

Gets whether the face has an OS/2 table.

public bool HasOs2 { get; }

Property value

bool

Gets whether the face is italic: bit 0 of OS/2.fsSelection, else bit 1 of head.macStyle.

public bool IsItalic { get; }

Property value

bool

Gets whether the face is monospaced (post.isFixedPitch).

public bool IsMonospaced { get; }

Property value

bool

Gets whether the face is oblique rather than italic: bit 9 of OS/2.fsSelection.

public bool IsOblique { get; }

Property value

bool

Gets the italic angle of the post table, in degrees counter-clockwise from the vertical.

public double ItalicAngle { get; }

Property value

double

Gets the head.macStyle field.

public int MacStyle { get; }

Property value

int

Gets the PostScript name of the face, or null when the font has none.

public string? PostScriptName { get; }

Property value

string?

Gets the OS/2.fsSelection field, 0 without an OS/2 table.

public int Selection { get; }

Property value

int

Gets the preferred subfamily name, such as Bold Italic, else an empty string.

public string SubfamilyName { get; }

Property value

string

Gets the weight class: OS/2.usWeightClass, else 700 or 400 from head.macStyle.

public int Weight { get; }

Property value

int

Gets the width class, OS/2.usWidthClass: from 1 (ultra-condensed) to 9 (ultra-expanded), 5 without an OS/2 table.

public int WidthClass { get; }

Property value

int

Methods

NameDescription
Covers(Rune)Determines whether the face has a glyph for a character.
ToString()Returns a string that represents the current object.

Determines whether the face has a glyph for a character.

public bool Covers(Rune character)

Parameters

character Rune
The character.

Returns

bool true when the character map of the face gives the character a glyph other than the missing glyph, as a loaded face does; false when it does not, or when the file can no longer be read or its character map is malformed.

Remarks

The first call reads the character map (the cmap table) of the face from its file, and keeps the characters it has with the collection, as ranges of characters. The characters of the faces of a collection are kept within a bounded amount of memory: when it is reached, the ones that were read first are dropped, and read again when they are needed. Scanning the fonts reads no character map.

Returns a string that represents the current object.

public override string ToString()

Returns

string A string that represents the current object.