InstalledFontCollection class
The font families installed on the system.
InstalledFontCollection lists the families that every program can use. It inherits FamilyCount and Families from FontCollection and adds nothing. It is read-only: fonts are installed and removed through Windows, not through this class. The class mirrors the GDI+ InstalledFontCollection class.
A FontFamily or a Font that is created without a collection looks in the installed fonts, so this class is needed only to list them.
Creating
Syntax: collection = InstalledFontCollection( )
Syntax: collection = New InstalledFontCollection
Warning 0.9.45.0 BETA 1005
Creating an InstalledFontCollection raises run-time error 438, Object doesn’t support this property or method, and the result is Nothing. The statement Debug.Assert TypeOf (Me) Is InstalledFontCollection in the class raises it. Even with that statement removed, the constructor does not store the native collection it creates, so the object has no handle and every call on it fails with InvalidParameter. The class cannot be used until a version of the package corrects both.
Dim user As GdiPlusUser = GdiPlusUser()
Dim fonts As InstalledFontCollection = InstalledFontCollection()
Dim families() As FontFamily = fonts.Families
Debug.Print "Installed families: " & fonts.FamilyCount
Debug.Print "The first one: " & families(1).FamilyName
See Also
- FontCollection class – the members this class inherits
- PrivateFontCollection class – fonts for one program only
- FontFamily class
- InstalledFontCollection class – Microsoft’s GDI+ reference