DevPinoy.org
A Filipino Developers Community
   
How To: List The Installed Fonts In Your Machine

This is a really basic stuff that alot of developers tend to forget(just like me :D)

[C# VERSION]

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing.Text;
using System.Drawing;

namespace KeithRull.MachineFonts
{
   class Program
   {
      static void Main(string[] args)
      {
         // all the fonts in your machine
         InstalledFontCollection installedFonts = new InstalledFontCollection();
         //iterate thru eachy font
         foreach (FontFamily fontFamily in installedFonts.Families)
         {
            //display the font in the screen
            Console.WriteLine(fontFamily.Name);
         }
         //stop and wait for the user to press a key to exit
         Console.ReadLine();
      }
   }
}

[VB.NET VERSION]

Imports System
Imports System.Collections.Generic
Imports System.Text
Imports System.Drawing.Text
Imports System.Drawing

Namespace KeithRull.MachineFonts
   Class Program
      Shared Sub Main(ByVal args() As String)
         ' all the fonts in your machine
         Dim installedFonts As InstalledFontCollection = New InstalledFontCollection() 
         'iterate thru eachy font
         Dim fontFamily As FontFamily
         For Each fontFamily In installedFonts.Families
            'display the font in the screen
            Console.WriteLine(fontFamily.Name)
         Next
         'stop and wait for the user to press a key to exit
         Console.ReadLine()
      End Sub
   End Class
End Namespace

basic yet useful :)


Posted 10-11-2006 1:28 PM by keithrull
Filed under: , , ,

Comments

Keith Rull wrote How To: Creating an ASP.NET Font Viewer
on 10-11-2006 4:51 PM

After creating this article , i realized that i can use a new utility in my toolbox. A Font Viewer. I

Copyright DevPinoy 2005-2008