Table of Contents

Class FontProvider

Namespace
CADability
Assembly
CADability.dll

Provides the fonts for Text and dimensions: the names of the font families, their metrics and the outlines of the glyphs. The kernel gets all fonts from Current, which works without any user interface. The default is a ManagedFontProvider, which reads the TrueType font files of the system itself and therefore works on every platform. CADability.Forms contains a provider based on GDI (GdiFontProvider), which gives the fonts exactly as CADability showed them on Windows before; as soon as CADability.Forms is used, it makes that provider the default, unless the application has set Current itself.

public abstract class FontProvider
Inheritance
FontProvider
Derived
Inherited Members

Constructors

FontProvider()

protected FontProvider()

Properties

Current

The font provider the kernel uses. Setting it clears the cached glyphs, so that texts are rebuilt with the new provider, like ClearFontCache(): set it before texts are painted, or rebuild the display lists of the views afterwards (InvalidateDisplayLists()). A provider set here is kept: CADability.Forms only replaces the default with its GDI provider while the application has not set one.

public static FontProvider Current { get; set; }

Property Value

FontProvider

Methods

GetDefaultFace(bool, bool)

Returns the face to use for a family that GetFace(string, bool, bool) does not know. The default implementation tries some common sans serif fonts and then takes the first family. Returns null when there is no font at all.

public virtual FontFace GetDefaultFace(bool bold, bool italic)

Parameters

bold bool
italic bool

Returns

FontFace

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 abstract 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 abstract string[] GetFamilyNames()

Returns

string[]