1 out of 2 rated this helpful - Rate this topic

FontFamily Class

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

System.Object
  System.MarshalByRefObject
    System.Drawing.FontFamily

Namespace:  System.Drawing
Assembly:  System.Drawing (in System.Drawing.dll)
public sealed class FontFamily : MarshalByRefObject, 
	IDisposable

The FontFamily type exposes the following members.

  Name Description
Public method FontFamily(GenericFontFamilies) Initializes a new FontFamily from the specified generic font family.
Public method FontFamily(String) Initializes a new FontFamily with the specified name.
Public method FontFamily(String, FontCollection) Initializes a new FontFamily in the specified FontCollection with the specified name.
Top
  Name Description
Public property Static member Families Returns an array that contains all the FontFamily objects associated with the current graphics context.
Public property Static member GenericMonospace Gets a generic monospace FontFamily.
Public property Static member GenericSansSerif Gets a generic sans serif FontFamily object.
Public property Static member GenericSerif Gets a generic serif FontFamily.
Public property Name Gets the name of this FontFamily.
Top
  Name Description
Public method CreateObjRef Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject.)
Public method Dispose Releases all resources used by this FontFamily.
Public method Equals Indicates whether the specified object is a FontFamily and is identical to this FontFamily. (Overrides Object.Equals(Object).)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetCellAscent Returns the cell ascent, in design units, of the FontFamily of the specified style.
Public method GetCellDescent Returns the cell descent, in design units, of the FontFamily of the specified style.
Public method GetEmHeight Gets the height, in font design units, of the em square for the specified style.
Public method Static member GetFamilies Obsolete. Returns an array that contains all the FontFamily objects available for the specified graphics context.
Public method GetHashCode Gets a hash code for this FontFamily. (Overrides Object.GetHashCode().)
Public method GetLifetimeService Retrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Public method GetLineSpacing Returns 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 method GetName Returns the name, in the specified language, of this FontFamily.
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method InitializeLifetimeService Obtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Public method IsStyleAvailable Indicates whether the specified FontStyle enumeration is available.
Protected method MemberwiseClone() Creates a shallow copy of the current Object. (Inherited from Object.)
Protected method MemberwiseClone(Boolean) Creates a shallow copy of the current MarshalByRefObject object. (Inherited from MarshalByRefObject.)
Public method ToString Converts 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, 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.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ