Export (0) Print
Expand All

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, 
	IDisposable

The FontFamily type exposes the following members.

  NameDescription
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.
Top

  NameDescription
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.
Top

  NameDescription
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).)
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.
Public methodToStringConverts this FontFamily to a human-readable string representation. (Overrides Object.ToString().)
Top

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 )
    {
        listBox1.Items.Add(oneFontFamily.Name);
    }
}

.NET Framework

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

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft