How to check if a font is present on the computer

Posted in: General vb.NET
By dePoPo
Mar 6, 2009 - 12:09:30 PM

This function checks if a certain font is installed. A value of 1 is returned if the font is present on the system, or a 0 if it does not exists


Public Function CheckFontPresence(ByVal s_fontname As String) As Integer
  Dim allfonts As New InstalledFontCollection
  For Each s_font As FontFamily In allfonts.Families
  If UCase(s_font.Name) = UCase(s_fontname) Then
  ' found the wanted font
  Return 1
  End If
  Next
  Return 0 ' no match
End Function


Visitor Comments