Creating A HTML Font List

by Jul 28, 2009

With just a couple of lines of code, you can create a HTML document listing each installed type face on your computer which you then can print out for reference. Next time you want to create a fancy newsletter or party invitation, grab your font reference and pick a type face.

[System.Reflection.Assembly]::LoadWithPartialName("System.Drawing") | Out-Null

# create HTML
$result = (New-Object System.Drawing.Text.InstalledFontCollection).Families |
ForEach-Object {$strHTML=''}{
$strHTML += "<font size='5' face='{0}'>{0}</font><br>" -f ($_.Name)
}{$strHTML}

# write HTML
Set-Content $homeFontList.htm $result

# open HTML
& "$homeFontList.htm"