Name

PrivateFontCollection

Synopsis

This class, derived from FontCollection, represents a set of fonts that have not been installed on the system.

You can add a font to the collection using the AddFontFile() and AddMemoryFont() methods. The second of these is a thin wrapper over the unmanaged implementation code, and you should be careful to ensure that the memory you pass in will not be garbage collected before you are done with the collection.

You can then enumerate the Families in the collection in the normal way.


public sealed class PrivateFontCollection : FontCollection {

// Public Constructors

   public PrivateFontCollection();

// Public Instance Methods

   public void AddFontFile(string filename);

   public void AddMemoryFont(IntPtr memory, int length);

// Protected Instance Methods

   protected override void Dispose(bool disposing);  // overrides FontCollection

}

Hierarchy

System.Object FontCollection(System.IDisposable) PrivateFontCollection

Get .NET Windows Forms in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.