RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: VB4/32,VB5,VB6
Expertise: Intermediate
Apr 27, 1999



Building the Right Environment to Support AI, Machine Learning and Deep Learning

CheckFont - Test whether a font is installed

' Test whether a font name and size is supported
' Returns True if the font is supported, False otherwise
' If the font is supported but the size is not, it returns
' the actual font size in the second argument
' If the font isn't supported, it return the system font
' name and size in the two arguments.

Function CheckFont(fontName As String, Optional fontSize As Integer) As Boolean
    On Error Resume Next
    ' Create a temporary StdFont object
    With New StdFont
        ' Assign the proposed font name
        .Name = fontName
        If fontSize > 0 Then .Size = fontSize
        ' Return true if font assignment succeded
        CheckFont = (StrComp(fontName, .Name, vbTextCompare) = 0)
        ' return actual font name and size through arguments
        fontName = .Name
        fontSize = .Size
    End With
End Function

Francesco Balena
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date