Skip to content

Commit 2793056

Browse files
committed
Remove Instance property since it is not part of System.Drawing interface and it is only used on FontFamily
1 parent 4acbf04 commit 2793056

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/Common/FontFamily.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,8 @@ public bool IsStyleAvailable(FontStyle style)
326326
/// <summary>
327327
/// Returns an array that contains all of the <see cref='FontFamily'/> objects of the system
328328
/// </summary>
329-
public static FontFamily[] Families => InstalledFontCollection.Instance.Families;
329+
public static FontFamily[] Families => s_Families ??= new InstalledFontCollection().Families;
330+
private static FontFamily[] s_Families; // cache to load the fonts once
330331

331332
/// <summary>
332333
/// Gets a generic monospace <see cref='FontFamily'/>.

src/Common/Text/InstalledFontCollection.cs

-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ public class InstalledFontCollection : FontCollection
1212
private static readonly string SYSTEM_FONT_PATH = Environment.GetFolderPath(Environment.SpecialFolder.Fonts);
1313
private static readonly string[] FONT_EXTENSIONS = { ".ttf", ".otf", ".eot", ".woff", ".woff2" };
1414

15-
public static readonly FontCollection Instance = new InstalledFontCollection();
16-
1715
/// <summary>
1816
/// Initializes a new instance of the <see cref='InstalledFontCollection'/> class.
1917
/// </summary>

0 commit comments

Comments
 (0)