Enumerating Installed Fonts

A very simple snippet that uses the InstalledFontCollection class from the System.Drawing.Text namespace:

import clr clr.AddReference("System.Drawing") from System.Drawing.Text import InstalledFontCollection

fontCollection = InstalledFontCollection for font in fontCollection.Families: print 'Font: "%s"' % font.Name

The same snippet works on Mono. Mono uses Fontconfig library to query font configuration in a cross-platform way.

Back to Contents.