• DR-IT Software
  • Products
  • Documentation
  • Product page
  • Examples
  • API reference
  • Support
Show / Hide Table of Contents

Class FontFamily

Represents a font family used for drawing text.

Inheritance
object
FontFamily
Implements
IDisposable
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: DRIT.Drawing.Text
Assembly: DRIT.Drawing.dll
Syntax
public sealed class FontFamily : IDisposable
Remarks

A FontFamily defines a set of fonts that share the same family name but differ in style (bold, italic, etc.). Use GenericSerif, GenericSansSerif, or GenericMonospace for generic families.

Constructors

FontFamily(GenericFontFamilies)

Initializes a new FontFamily with the specified generic font family.

Declaration
public FontFamily(GenericFontFamilies genericFamily)
Parameters
Type Name Description
GenericFontFamilies genericFamily

The generic font family.

Remarks

A FontFamily defines a set of fonts that share the same family name but differ in style (bold, italic, etc.). Use GenericSerif, GenericSansSerif, or GenericMonospace for generic families.

FontFamily(string)

Initializes a new FontFamily with the specified font family name.

Declaration
public FontFamily(string name)
Parameters
Type Name Description
string name

The name of the font family.

Remarks

The name is first looked up in the process-wide InstalledFontCollection. When a matching installed family is found it is used (with real metrics and glyph outlines). When no installed family matches, a fallback with guessed metrics is created so that the instance is still usable for measurement.

Properties

GenericMonospace

Gets a FontFamily representing the monospace font family.

Declaration
public static FontFamily GenericMonospace { get; }
Property Value
Type Description
FontFamily
Remarks

A FontFamily defines a set of fonts that share the same family name but differ in style (bold, italic, etc.). Use GenericSerif, GenericSansSerif, or GenericMonospace for generic families.

GenericSansSerif

Gets a FontFamily representing the sans-serif font family.

Declaration
public static FontFamily GenericSansSerif { get; }
Property Value
Type Description
FontFamily
Remarks

A FontFamily defines a set of fonts that share the same family name but differ in style (bold, italic, etc.). Use GenericSerif, GenericSansSerif, or GenericMonospace for generic families.

GenericSerif

Gets a FontFamily representing the serif font family.

Declaration
public static FontFamily GenericSerif { get; }
Property Value
Type Description
FontFamily
Remarks

A FontFamily defines a set of fonts that share the same family name but differ in style (bold, italic, etc.). Use GenericSerif, GenericSansSerif, or GenericMonospace for generic families.

Name

Gets the name of this font family.

Declaration
public string Name { get; }
Property Value
Type Description
string
Remarks

A FontFamily defines a set of fonts that share the same family name but differ in style (bold, italic, etc.). Use GenericSerif, GenericSansSerif, or GenericMonospace for generic families.

Methods

Dispose()

Releases all resources used by this font family.

Declaration
public void Dispose()
Remarks

A FontFamily defines a set of fonts that share the same family name but differ in style (bold, italic, etc.). Use GenericSerif, GenericSansSerif, or GenericMonospace for generic families.

GetCellAscent(FontStyle)

Gets the cell ascent of the font in design units.

Declaration
public int GetCellAscent(FontStyle style)
Parameters
Type Name Description
FontStyle style

The font style.

Returns
Type Description
int

The cell ascent in design units.

Remarks

A FontFamily defines a set of fonts that share the same family name but differ in style (bold, italic, etc.). Use GenericSerif, GenericSansSerif, or GenericMonospace for generic families.

GetCellDescent(FontStyle)

Gets the cell descent of the font in design units.

Declaration
public int GetCellDescent(FontStyle style)
Parameters
Type Name Description
FontStyle style

The font style.

Returns
Type Description
int

The cell descent in design units.

Remarks

A FontFamily defines a set of fonts that share the same family name but differ in style (bold, italic, etc.). Use GenericSerif, GenericSansSerif, or GenericMonospace for generic families.

GetEmHeight(FontStyle)

Gets the em height of the font in design units.

Declaration
public int GetEmHeight(FontStyle style)
Parameters
Type Name Description
FontStyle style

The font style.

Returns
Type Description
int

The em height in design units.

Remarks

A FontFamily defines a set of fonts that share the same family name but differ in style (bold, italic, etc.). Use GenericSerif, GenericSansSerif, or GenericMonospace for generic families.

GetLineSpacing(FontStyle)

Gets the line spacing of the font in design units.

Declaration
public int GetLineSpacing(FontStyle style)
Parameters
Type Name Description
FontStyle style

The font style.

Returns
Type Description
int

The line spacing in design units.

Remarks

A FontFamily defines a set of fonts that share the same family name but differ in style (bold, italic, etc.). Use GenericSerif, GenericSansSerif, or GenericMonospace for generic families.

IsStyleAvailable(FontStyle)

Gets a value indicating whether the specified font style is available.

Declaration
public bool IsStyleAvailable(FontStyle style)
Parameters
Type Name Description
FontStyle style

The font style to check.

Returns
Type Description
bool

true if the style is available; otherwise, false.

Remarks

A FontFamily defines a set of fonts that share the same family name but differ in style (bold, italic, etc.). Use GenericSerif, GenericSansSerif, or GenericMonospace for generic families.

Implements

IDisposable
Back to top

DR-IT Software documentation

DR-IT Software · Products · Documentation index · Product page · Downloads · Support · Licensing

Generated by DocFX