diff --git a/src/EPPlus.Fonts.OpenType/FontDiscovery.cs b/src/EPPlus.Fonts.OpenType/FontDiscovery.cs index 5ee7c96a3..2eafabf1f 100644 --- a/src/EPPlus.Fonts.OpenType/FontDiscovery.cs +++ b/src/EPPlus.Fonts.OpenType/FontDiscovery.cs @@ -16,6 +16,7 @@ Date Author Change using System; using System.Collections.Generic; using System.IO; +using System.Linq; namespace EPPlus.Fonts.OpenType { @@ -87,5 +88,28 @@ private static bool MatchesFormat(string filePath, FontFormat target) return format == target; } + + /// + /// Returns information about all font faces found in the given directories and, + /// optionally, the system font directories. Fonts are scanned for metadata only, + /// they are not fully loaded. Faces inside a TTC collection are returned as separate entries. + /// + public static List GetAllFontFaces( + IEnumerable fontDirectories = null, + bool searchSystemDirectories = true) + { + var locations = DefaultFontLocations.GetLocationsCollection(fontDirectories, searchSystemDirectories); + return FontScannerV2.EnumerateAllFaces(locations); + } + + /// + /// Returns the directories that are searched for fonts, in search order. + /// + public static List GetFontDirectories( + IEnumerable fontDirectories = null, + bool searchSystemDirectories = true) + { + return DefaultFontLocations.GetLocationsCollection(fontDirectories, searchSystemDirectories); + } } } \ No newline at end of file