Class InstalledFontCollection
Represents the collection of fonts installed on the system. The collection is populated on first use by querying the platform's native font service (Windows registry, macOS CoreText, Linux fontconfig) and falling back to directory scanning. The result is cached for the lifetime of the process.
Implements
Inherited Members
Namespace: DRIT.Drawing.Text
Assembly: DRIT.Drawing.dll
Syntax
public sealed class InstalledFontCollection : FontCollection, IDisposable
Remarks
The auto-loading behaviour can be controlled via FontSettings. Set
AutoLoadSystemFonts to false before first access
to Default to disable system font scanning entirely (useful in web
and server scenarios). Set UseNativeFontApis to
false to skip native API calls and use directory scanning only.
Constructors
InstalledFontCollection()
Initializes a new InstalledFontCollection and discovers the
system fonts. This matches the GDI+ new InstalledFontCollection()
semantics where construction enumerates installed fonts.
Declaration
public InstalledFontCollection()
Remarks
The auto-loading behaviour can be controlled via FontSettings. Set
AutoLoadSystemFonts to false before first access
to Default to disable system font scanning entirely (useful in web
and server scenarios). Set UseNativeFontApis to
false to skip native API calls and use directory scanning only.
Properties
Default
Gets the process-wide default InstalledFontCollection. The system fonts are discovered once on first access and the result is cached for subsequent calls.
Declaration
public static InstalledFontCollection Default { get; }
Property Value
| Type | Description |
|---|---|
| InstalledFontCollection |
Remarks
The behaviour of this property is controlled by FontSettings. Changes to FontSettings after first access have no effect.
DefaultFamilyName
The default font family name as reported by the operating system, or
null when the OS did not provide one.
Declaration
public string? DefaultFamilyName { get; }
Property Value
| Type | Description |
|---|---|
| string |
Remarks
The auto-loading behaviour can be controlled via FontSettings. Set
AutoLoadSystemFonts to false before first access
to Default to disable system font scanning entirely (useful in web
and server scenarios). Set UseNativeFontApis to
false to skip native API calls and use directory scanning only.