Table of Contents

Class ManagedFontProvider

Namespace
CADability
Assembly
CADability.dll

The default FontProvider: reads TrueType and OpenType font files (.ttf, .ttc, .otf, .otc) itself, so it needs neither GDI nor any other part of the operating system and works on Windows, Linux, macOS and in the browser. By default it uses the font directories of the system; more files or directories can be added. The named instances of a variable font (TrueType with "gvar" or OpenType with "CFF2") are faces of their own, with family names as GDI makes them, e.g. "Bahnschrift Light Condensed". Bitmap fonts are left out. A bold or italic face that a family does not have is synthesized from the closest face, as GDI+ does it (see CADability.SyntheticFontFace).

public class ManagedFontProvider : FontProvider
Inheritance
ManagedFontProvider
Inherited Members

Constructors

ManagedFontProvider()

Creates a provider for the fonts installed on the system.

public ManagedFontProvider()

ManagedFontProvider(IEnumerable<string>, bool)

Creates a provider for the fonts in fontDirectories (with their subdirectories) and, if includeSystemFonts is true, for the fonts installed on the system.

public ManagedFontProvider(IEnumerable<string> fontDirectories, bool includeSystemFonts)

Parameters

fontDirectories IEnumerable<string>
includeSystemFonts bool

Methods

AddFontData(byte[])

Adds the fonts of a font file given as its content, e.g. an embedded resource.

public void AddFontData(byte[] data)

Parameters

data byte[]

AddFontFile(string)

Adds the fonts of a font file (.ttf, .ttc, .otf or .otc).

public void AddFontFile(string fileName)

Parameters

fileName string

GetFace(string, bool, bool)

Returns the face of the font family familyName (not case sensitive) that matches the requested style best, or null if the provider does not know this family.

public override FontFace GetFace(string familyName, bool bold, bool italic)

Parameters

familyName string

The name of the font family, e.g. "Arial"

bold bool

Bold requested

italic bool

Italic requested

Returns

FontFace

GetFamilyNames()

The names of all font families this provider knows, e.g. for a list to choose from.

public override string[] GetFamilyNames()

Returns

string[]

SystemFontDirectories()

The directories where the fonts of the system are installed on the current platform.

public static IEnumerable<string> SystemFontDirectories()

Returns

IEnumerable<string>