devxlogo

CheckFont – Test whether a font is installed

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 WithEnd Function

See also  Professionalism Starts in Your Inbox: Keys to Presenting Your Best Self in Email
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist