This documentation is archived and is not being maintained.

FontFamily Class

Defines a group of type faces having a similar basic design and certain variations in styles. This class cannot be inherited.

Namespace:  System.Drawing
Assembly:  System.Drawing (in System.Drawing.dll)

public sealed class FontFamily : MarshalByRefObject, 

The FontFamily type exposes the following members.

Public methodFontFamily(GenericFontFamilies)Initializes a new FontFamily from the specified generic font family.
Public methodFontFamily(String)Initializes a new FontFamily with the specified name.
Public methodFontFamily(String, FontCollection)Initializes a new FontFamily in the specified FontCollection with the specified name.

Public propertyStatic memberFamiliesReturns an array that contains all the FontFamily objects associated with the current graphics context.
Public propertyStatic memberGenericMonospaceGets a generic monospace FontFamily.
Public propertyStatic memberGenericSansSerifGets a generic sans serif FontFamily object.
Public propertyStatic memberGenericSerifGets a generic serif FontFamily.
Public propertyNameGets the name of this FontFamily.

Public methodCreateObjRefCreates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject.)
Public methodDisposeReleases all resources used by this FontFamily.
Public methodEqualsIndicates whether the specified object is a FontFamily and is identical to this FontFamily. (Overrides Object.Equals(Object).)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetCellAscentReturns the cell ascent, in design units, of the FontFamily of the specified style.
Public methodGetCellDescentReturns the cell descent, in design units, of the FontFamily of the specified style.
Public methodGetEmHeightGets the height, in font design units, of the em square for the specified style.
Public methodStatic memberGetFamilies Obsolete. Returns an array that contains all the FontFamily objects available for the specified graphics context.
Public methodGetHashCodeGets a hash code for this FontFamily. (Overrides Object.GetHashCode().)
Public methodGetLifetimeServiceRetrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Public methodGetLineSpacingReturns the line spacing, in design units, of the FontFamily of the specified style. The line spacing is the vertical distance between the base lines of two consecutive lines of text.
Public methodGetNameReturns the name, in the specified language, of this FontFamily.
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodInitializeLifetimeServiceObtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Public methodIsStyleAvailableIndicates whether the specified FontStyle enumeration is available.
Protected methodMemberwiseClone()Creates a shallow copy of the current Object. (Inherited from Object.)
Protected methodMemberwiseClone(Boolean)Creates a shallow copy of the current MarshalByRefObject object. (Inherited from MarshalByRefObject.)
Public methodToStringConverts this FontFamily to a human-readable string representation. (Overrides Object.ToString().)

The following code example shows all the font families in the Families property of the FontFamily class. This example is designed to be used with a Windows Form. To run this example, add a ListBox named listBox1 to a form and call the PopulateListBoxWithFonts method from the form's constructor.

private void PopulateListBoxWithFonts()
    listBox1.Width = 200;
    listBox1.Location = new Point(40, 120);
    foreach ( FontFamily oneFontFamily in FontFamily.Families )

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.