Solved

How do I check if a font exists on the user's computer?

Posted on 2011-09-23
1
664 Views
Last Modified: 2013-12-17
I have code to install fonts, but I don't want to be running that code every time the user starts the program...only when the font does not exist.  So how do I check to see if the font is already loaded on the user's machine?
0
Comment
Question by:David L. Hansen
1 Comment
 
LVL 13

Accepted Solution

by:
StormITSolutions earned 500 total points
Comment Utility
Imports System
Imports System.Windows.Forms
Imports System.Drawing.Text
Imports System.Drawing

Public Class MainClass
    
    Shared Sub Main(ByVal args As String())
        ' Get the installed fonts collection.
        Dim installed_fonts As New InstalledFontCollection

        ' Get an array of the system's font familiies.
        Dim font_families() As FontFamily = installed_fonts.Families()

        ' Display the font families.
        For Each font_family As FontFamily In font_families
            Console.Write (font_family.Name & ", ")
        Next font_family
    End Sub
End Class

Open in new window


This is a way to get all the fonts installed on a system


Use something like this
InstalledFontCollection installedFontCollection = new InstalledFontCollection();

// Get the array of FontFamily objects.
FontFamily[] fontFamilies = installedFontCollection.Families;

Open in new window


Then compare the font you want to install with the array for a match

Storm
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now