InstalledFontCollection
Represents the fonts installed on the system. This class cannot be inherited.
using System.Runtime.CompilerServices;
using Windows.Win32;
using Windows.Win32.Graphics.GdiPlus;
namespace System.Drawing.Text
{
[NullableContext(1)]
[Nullable(0)]
public sealed class InstalledFontCollection : FontCollection
{
internal static InstalledFontCollection Instance { get; } = new InstalledFontCollection();
public unsafe InstalledFontCollection()
: base(Create())
{
GC.SuppressFinalize(this);
}
[NullableContext(0)]
private unsafe static GpFontCollection* Create()
{
GpFontCollection* result = default(GpFontCollection*);
PInvokeGdiPlus.GdipNewInstalledFontCollection(&result).ThrowIfFailed();
return result;
}
protected override void Dispose(bool disposing)
{
}
}
}